OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

What is the meaning of e.fn in this code

  • Thread starter Thread starter bernie2436
  • Start date Start date
B

bernie2436

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

Code:
(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:

Code:
(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?

<p>I am looking at this javascript code from the <a href="http://quojs.tapquo.com/" rel="nofollow">quojs</a> library:</p>

<pre><code>(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
}();
</code></pre>

<p>which comes before this:</p>

<pre><code>(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
} else {
return Array.prototype.slice.call(u)
}
};

e.fn.find = function (t) {
</code></pre>

<p>I am trying to understand the meaning of e.fn. </p>

<p>I see that fn is not a <a href="http://javascript.about.com/library/blreserved.htm" rel="nofollow">reserved word</a>. 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?</p>
 

Latest posts

Top