X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjquery%2Fjquery.js;h=9f2189eb9e0bb625f8b9b8ee86f46316742d9246;hb=3b4eeab0444e7295802a4f090257ac5dac6f556a;hp=5fd368aa077bf1eb3ae4d8b600b9599c81e3b12d;hpb=4dcbfc92c391983059b920d2a500c1246869f4c7;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 5fd368a..9f2189e 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -31,7 +31,7 @@ window.undefined = window.undefined; jQuery = function(a,c) { // Shortcut for document ready (because $(document).each() is silly) - if ( a && a.constructor == Function && jQuery.fn.ready ) + if ( a && typeof a == "function" && jQuery.fn.ready ) return jQuery(document).ready(a); // Make sure that a selection was provided @@ -65,7 +65,7 @@ jQuery = function(a,c) { var fn = arguments[ arguments.length - 1 ]; // If so, execute it in context - if ( fn && fn.constructor == Function ) + if ( fn && typeof fn == "function" ) this.each(fn); }; @@ -1019,7 +1019,7 @@ jQuery.fn = jQuery.prototype = { t.constructor == Boolean && ( t ? this.get() : [] ) || - t.constructor == Function && + typeof t == "function" && jQuery.grep( this, t ) || jQuery.filter(t,this).r, arguments ); @@ -1214,7 +1214,7 @@ jQuery.fn = jQuery.prototype = { } else { var old = this.get(); this.get( a ); - if ( fn.constructor == Function ) + if ( typeof fn == "function" ) this.each( fn ); this.get( old ); } @@ -1373,9 +1373,22 @@ jQuery.extend({ o.className += ( o.className ? " " : "" ) + c; }, remove: function(o,c){ + /* o.className = !c ? "" : o.className.replace( - new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), ""); + new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), "");*/ + if( !c ) { + o.className = ""; + } else { + var classes = o.className.split(" "); + for(var i=0; iHello

Hello Again

And Again

* @result [ Hello Again ] * + * @test isSet( $("#foo").children().get(), q("sndp", "en", "sap"), "Check for children" ); + * * @name children * @type jQuery * @cat DOM/Traversing @@ -3044,6 +3062,8 @@ jQuery.macros = { * @before
Hello

Hello Again

And Again

* @result [

Hello Again

] * + * @test isSet( $("#foo").children("[code]").get(), q("sndp", "sap"), "Check for filtered children" ); + * * @name children * @type jQuery * @param String expr An expression to filter the child Elements with @@ -3173,6 +3193,14 @@ jQuery.macros = { * } * ok( pass, "Remove Class" ); * + * @test var div = $("div").addClass("test").addClass("foo").addClass("bar"); + * div.removeClass("test").removeClass("bar").removeClass("foo"); + * var pass = true; + * for ( var i = 0; i < div.size(); i++ ) { + * if ( div.get(i).className.match(/test|bar|foo/) ) pass = false; + * } + * ok( pass, "Remove multiple classes" ); + * * @name removeClass * @type jQuery * @param String class A CSS class to remove from the elements