X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjquery%2Fjquery.js;h=7b712c955583cb26c0c0d0a72f96eb63ac155257;hb=65a88fae8919e5da774dcc45c9b42220f875b697;hp=7f7ef08d1089f80fefcb767f037cddb58752886a;hpb=b8d46f7b6a38d92d9e0ad0b0df12c773bcf1c634;p=jquery.git
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 7f7ef08..7b712c9 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -510,9 +510,9 @@ jQuery.fn = jQuery.prototype = {
e = e || this;
var t = "";
- for ( var j = 0; j < e.length; j++ ) {
+ for ( var j = 0, el = e.length; j < el; j++ ) {
var r = e[j].childNodes;
- for ( var i = 0; i < r.length; i++ )
+ for ( var i = 0, rl = r.length; i < rl; i++ )
if ( r[i].nodeType != 8 )
t += r[i].nodeType != 1 ?
r[i].nodeValue : jQuery.fn.text([ r[i] ]);
@@ -882,7 +882,7 @@ jQuery.fn = jQuery.prototype = {
return this.pushStack(
t.constructor == Array &&
jQuery.map(this,function(a){
- for ( var i = 0; i < t.length; i++ )
+ for ( var i = 0, tl = t.length; i < tl; i++ )
if ( jQuery.filter(t[i],[a]).r.length )
return a;
return null;
@@ -1030,7 +1030,7 @@ jQuery.fn = jQuery.prototype = {
if ( table && this.nodeName.toUpperCase() == "TABLE" && a[0].nodeName.toUpperCase() == "TR" )
obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
- for ( var i=0; i < a.length; i++ )
+ for ( var i = 0, al = a.length; i < al; i++ )
fn.apply( obj, [ clone ? a[i].cloneNode(true) : a[i] ] );
});
@@ -1164,7 +1164,7 @@ jQuery.extend({
jQuery.fn[ i ] = function(){
var a = arguments;
return this.each(function(){
- for ( var j = 0; j < a.length; j++ )
+ for ( var j = 0, al = a.length; j < al; j++ )
jQuery(a[j])[n]( this );
});
};
@@ -1229,34 +1229,26 @@ jQuery.extend({
for ( var i in obj )
fn.apply( obj[i], args || [i, obj[i]] );
else
- for ( var i = 0; i < obj.length; i++ )
+ for ( var i = 0, ol = obj.length; i < ol; i++ )
if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break;
return obj;
},
className: {
- add: function(o,c){
- if (jQuery.className.has(o,c)) return;
- o.className += ( o.className ? " " : "" ) + c;
+ add: function( elem, c ){
+ jQuery.each( c.split(/\s+/), function(i, cur){
+ if ( !jQuery.className.has( elem.className, cur ) )
+ elem.className += ( elem.className ? " " : "" ) + cur;
+ });
},
- remove: function(o,c){
- if( !c ) {
- o.className = "";
- } else {
- var classes = o.className.split(" ");
- for(var i=0; i
Hello
] * + * @example $("p").removeClass("selected") + * @beforeHello
+ * @result [Hello
] + * * @name removeClass * @type jQuery - * @param String class A CSS class to remove from the elements + * @param String class (optional) A CSS class to remove from the elements * @cat DOM */ removeClass: function(c){ @@ -3286,4 +3294,4 @@ jQuery.macros = { } }; -jQuery.init(); +jQuery.init(); \ No newline at end of file