git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
136a459
)
Added a performance improvement to .hide()/.show() that helps to prevent constant...
author
John Resig
<jeresig@gmail.com>
Mon, 9 Feb 2009 15:58:12 +0000
(15:58 +0000)
committer
John Resig
<jeresig@gmail.com>
Mon, 9 Feb 2009 15:58:12 +0000
(15:58 +0000)
src/fx.js
patch
|
blob
|
history
diff --git
a/src/fx.js
b/src/fx.js
index
39456e0
..
3d00515
100644
(file)
--- a/
src/fx.js
+++ b/
src/fx.js
@@
-44,7
+44,13
@@
jQuery.fn.extend({
elemdisplay[ tagName ] = display;
}
elemdisplay[ tagName ] = display;
}
- this[i].style.display = jQuery.data(this[i], "olddisplay", display);
+ jQuery.data(this[i], "olddisplay", display);
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ this[i].style.display = jQuery.data(this[i], "olddisplay");
}
}
}
}
@@
-60,8
+66,14
@@
jQuery.fn.extend({
var old = jQuery.data(this[i], "olddisplay");
if ( !old && old !== "none" )
jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
var old = jQuery.data(this[i], "olddisplay");
if ( !old && old !== "none" )
jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var i = 0, l = this.length; i < l; i++ ){
this[i].style.display = "none";
}
this[i].style.display = "none";
}
+
return this;
}
},
return this;
}
},