-
how jQuery use sizzle selector
The call stack is as follow <pre data-sub="prettyprint:_">return new jQuery.fn.init( selector, context ); return (context || rootjQuery).find( selector ); jQuery.find( selector, this[i], ret ); return makeArray(context.querySelectorAll(query), extra );
-
the internal of $.end() method
jQuery methods that alter the original jQuery wrapper set selected are considered to be destructive.The reason being that they do not maintain the original state of the wrapper set. Not to worry;nothing is really destroyed or removed. Rather, the former wrapper set is attached to a new set.
pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = jQuery();
-
$.extend
extend function is used to extend jQuery object. We can use it to do extend normal object, jQuery utility and jQuery method.
-
$(fn)
In jQuery, $(fn) is a short cut to $.fn.ready(fn). First you call the $.fn.ready(fn), in the function it call jQuery.bindReady() first, then add the fn to a readyList. In the jQuery.bindReady() function, it try to hookup DOMContentLoaded handler, in IE the event is called onreadystatechange. In the DOMContentLoaded handler, it call the jQuery.ready() function, in side of this function, the function in the readyList is invoked
-
jQuery is an array like object
In javascript, array is object, so there are lots benefit to use array object, like the length, index, slice. jQuery is a collection of element, so use it as an array is very convenient. it seems to me that jQuery object can not use array as prototype for some reason, so how we can use an object like an array, please read the following code.
var x = {}; x[0] = "zero"; x[1] = "one"