当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - What is the meaning of e.fn in this code

问题描述:

I am looking at this javascript code from the quojs library:

(function() {

var e;

e = function() {

var e, t, n;

t = [];

e = function(t, r) {

var i;

if (!t) {

return n()

} else if (e.toType(t) === "function") {

return e(document).ready(t)

} else {

i = e.getDOMObject(t, r);

return n(i, t)

}

};

n = function(e, r) {

e = e || t;

e.__proto__ = n.prototype;

e.selector = r || "";

return e

};

e.extend = function(e) {

Array.prototype.slice.call(arguments, 1).forEach(function(t) {

var n, r;

r = [];

for (n in t) {

r.push(e[n] = t[n])

}

return r

});

return e

};

n.prototype = e.fn = {};

return e

}();

which comes before this:

(function () {

(function (e) {

var t, n, r, i, u, a;

r = "parentNode";

t = /^\.([\w-]+)$/;

n = /^#[\w\d-]+$/;

i = /^[\w-]+$/;

e.query = function (e, r) {

var u;

r = r.trim();

if (t.test(r)) {

u = e.getElementsByClassName(r.replace(".", ""))

} else if (i.test(r)) {

u = e.getElementsByTagName(r)

} else if (n.test(r) && e === document) {

u = e.getElementById(r.replace("#", ""));

if (!u) {

u = []

}

} else {

u = e.querySelectorAll(r)

}

if (u.nodeType) {

return [u]

} else {

return Array.prototype.slice.call(u)

}

};

e.fn.find = function (t) {

I am trying to understand the meaning of e.fn.

I see that fn is not a reserved word. I think that e is just the name given to the event object passed as a parameter. So what is the meaning of e.fn? Is the code assuming that whatever is passed as e has a property called fn? Or is fn some kind of abbreviation that references the function?

网友答案:

Whatever is passed as e should have a property called fn. I would search the rest of the code for "fn" and see what you come up with.

分享给朋友:
您可能感兴趣的文章:
随机阅读: