X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=ad65585d6ec6fbf75e107587bb9dce8feb45100f;hb=288b1a67303174f336ac4111c50747d609cba32a;hp=ef5556742f168e0d9b73c13cd7226d811a99d9f4;hpb=0f458cf806ed4013dc2ef289c990f3818df0fd25;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index ef55567..ad65585 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -38,11 +38,11 @@ function jQuery(a,c) { // Watch for when a jQuery object is passed as the selector if ( a.jquery ) - return $( jQuery.merge( a, [] ) ); + return jQuery( jQuery.merge( a, [] ) ); // Watch for when a jQuery object is passed at the context if ( c && c.jquery ) - return $( c ).find(a); + return jQuery( c ).find(a); // If the context is global, return a new object if ( window == this ) @@ -69,7 +69,7 @@ function jQuery(a,c) { } // Map over the $ in case of overwrite -if ( $ ) +if ( typeof $ != "undefined" ) jQuery._$ = $; // Map the jQuery namespace to the '$' one @@ -378,8 +378,9 @@ jQuery.fn = jQuery.prototype = { for ( var j = 0; j < e.length; j++ ) { var r = e[j].childNodes; for ( var i = 0; i < r.length; i++ ) - t += r[i].nodeType != 1 ? - r[i].nodeValue : jQuery.fn.text([ r[i] ]); + if ( r[i].nodeType != 8 ) + t += r[i].nodeType != 1 ? + r[i].nodeValue : jQuery.fn.text([ r[i] ]); } return t; }, @@ -637,6 +638,7 @@ jQuery.fn = jQuery.prototype = { * @example $("p").not("#selected") * @before

Hello

Hello Again

* @result [

Hello

] + * @test cmpOK($("#main > p#ap > a").not("#google").length, "==", 2, ".not") * * @name not * @type jQuery @@ -821,7 +823,7 @@ jQuery.extend({ var a = arguments; return this.each(function(){ for ( var j = 0; j < a.length; j++ ) - $(a[j])[n]( this ); + jQuery(a[j])[n]( this ); }); }; }); @@ -922,7 +924,7 @@ jQuery.extend({ oHeight = e.offsetHeight; oWidth = e.offsetWidth; } else { - e = $(e.cloneNode(true)).css({ + e = jQuery(e.cloneNode(true)).css({ visibility: "hidden", position: "absolute", display: "block" }).prependTo("body")[0]; @@ -1024,6 +1026,7 @@ jQuery.extend({ odd: "i%2", // Child Checks + "nth-child": "jQuery.sibling(a,m[3]).cur", "first-child": "jQuery.sibling(a,0).cur", "last-child": "jQuery.sibling(a,0).last", "only-child": "jQuery.sibling(a).length==1", @@ -1107,7 +1110,7 @@ jQuery.extend({ * @test t( "Adjacent", "p + p", ["ap","en","sap"] ); * @test t( "Comma, Child, and Adjacent", "a + a, code > a", ["groups","anchor1","anchor2"] ); * @test t( "First Child", "p:first-child", ["firstp","sndp"] ); - * @test t( "Attribute Exists", "a[@title]", ["google"] ); + * @test t( "Attribute Exists", "a[@title]", ["google"] ); * @test t( "Attribute Exists", "*[@title]", ["google"] ); * @test t( "Attribute Exists", "[@title]", ["google"] ); * @test t( "Attribute Equals", "a[@rel='bookmark']", ["simon1"] ); @@ -1196,6 +1199,8 @@ jQuery.extend({ var foundToken = false; for ( var i = 0; i < jQuery.token.length; i += 2 ) { + if ( foundToken ) continue; + var re = new RegExp("^(" + jQuery.token[i] + ")"); var m = re.exec(t); @@ -1232,8 +1237,9 @@ jQuery.extend({ ); } } - } + } + if ( t ) { var val = jQuery.filter(t,r); ret = r = val.r; @@ -1264,7 +1270,9 @@ jQuery.extend({ "class": "className", "float": "cssFloat", innerHTML: "innerHTML", - className: "className" + className: "className", + value: "value", + disabled: "disabled" }; if ( fix[name] ) { @@ -2382,7 +2390,7 @@ jQuery.macros = { * @param String expr An expression to filter the child Elements with * @cat DOM/Traversing */ - children: "a.childNodes" + children: "jQuery.sibling(a.firstChild)" }, each: { @@ -2452,7 +2460,7 @@ jQuery.macros = { * @cat Effects */ toggle: function(){ - $(this)[ $(this).is(":hidden") ? "show" : "hide" ].apply( $(this), arguments ); + jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ].apply( jQuery(this), arguments ); }, /** @@ -2548,7 +2556,7 @@ jQuery.macros = { * @cat DOM/Manipulation */ remove: function(a){ - if ( !a || jQuery.filter( [this], a ).r ) + if ( !a || jQuery.filter( a, [this] ).r ) this.parentNode.removeChild( this ); }, @@ -2596,7 +2604,7 @@ jQuery.macros = { */ bind: function( type, fn ) { if ( fn.constructor == String ) - fn = new Function("e", ( !fn.indexOf(".") ? "$(this)" : "return " ) + fn); + fn = new Function("e", ( !fn.indexOf(".") ? "jQuery(this)" : "return " ) + fn); jQuery.event.add( this, type, fn ); },