X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=011ea36275249689131d4cc9eccb02a894c6fccd;hb=382a7ecd6d8e9a39bf24cec81fd65971ef3f8ada;hp=9db0f9d5f5f280be42709d806d12d9e29a639599;hpb=9449591eef44360b5bfdb9a23cea1f4a1a6f3c33;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 9db0f9d..011ea36 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -33,7 +33,7 @@ var jQuery = function(a,c) { // HANDLE: $(function) // Shortcut for document ready // Safari reports typeof on DOM NodeLists as a function - if ( typeof a == "function" && !a.nodeType && a[0] == undefined ) + if ( jQuery.isFunction(a) && !a.nodeType && a[0] == undefined ) return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a ); // Handle HTML strings @@ -320,17 +320,17 @@ jQuery.fn = jQuery.prototype = { * Returns -1 if the object wasn't found. * * @example $("*").index( $('#foobar')[0] ) - * @before
+ * @before
* @result 0 * @desc Returns the index for the element with ID foobar * - * @example $("*").index( $('#foo')) - * @before
+ * @example $("*").index( $('#foo')[0] ) + * @before
* @result 2 - * @desc Returns the index for the element with ID foo + * @desc Returns the index for the element with ID foo within another element * - * @example $("*").index( $('#bar')) - * @before
+ * @example $("*").index( $('#bar')[0] ) + * @before
* @result -1 * @desc Returns -1, as there is no element with ID bar * @@ -548,7 +548,7 @@ jQuery.fn = jQuery.prototype = { "textContent" : "innerText"; return e == undefined ? - jQuery.map(this, function(a){ return a[ type ]; }).join('') : + jQuery.map(this, function(a){ return a[ type ]; }).join("") : this.each(function(){ this[ type ] = e; }); }, @@ -864,7 +864,7 @@ jQuery.fn = jQuery.prototype = { */ filter: function(t) { return this.pushStack( - t.constructor == Function && + jQuery.isFunction( t ) && jQuery.grep(this, function(el, index){ return t.apply(el, [index]) }) || @@ -915,7 +915,7 @@ jQuery.fn = jQuery.prototype = { * * @name not * @type jQuery - * @param Array|jQuery elems A set of elements to remove from the jQuery set of matched elements. + * @param jQuery elems A set of elements to remove from the jQuery set of matched elements. * @cat DOM/Traversing */ not: function(t) { @@ -925,18 +925,18 @@ jQuery.fn = jQuery.prototype = { jQuery.grep(this,function(a){ if ( t.constructor == Array || t.jquery ) - return !jQuery.inArray( t, a ); + return jQuery.inArray( t, a ) < 0; else return a != t; }) ); }, /** - * Adds the elements matched by the expression to the jQuery object. This - * can be used to concatenate the result sets of two expressions. + * Adds more elements, matched by the given expression, + * to the set of matched elements. * * @example $("p").add("span") - * @before

Hello

Hello Again

+ * @before

Hello

Hello Again * @result [

Hello

, Hello Again ] * * @name add @@ -946,7 +946,8 @@ jQuery.fn = jQuery.prototype = { */ /** - * Adds the on the fly created elements to the jQuery object. + * Adds more elements, created on the fly, to the set of + * matched elements. * * @example $("p").add("Again") * @before

Hello

@@ -961,15 +962,13 @@ jQuery.fn = jQuery.prototype = { /** * Adds one or more Elements to the set of matched elements. * - * This is used to add a set of Elements to a jQuery object. - * * @example $("p").add( document.getElementById("a") ) * @before

Hello

Hello Again

* @result [

Hello

, Hello Again ] * - * @example $("p").add([document.getElementById("a"), document.getElementById("b")]) - * @before

Hello

Hello AgainAnd Again

- * @result [

Hello

, Hello Again, And Again ] + * @example $("p").add( document.forms[0].elements ) + * @before

Hello