Small optimization to jQuery.css to save 12 bytes

This commit is contained in:
Brandon Aaron 2007-04-03 03:04:38 +00:00
parent 9c94ef4c41
commit 14fa1e858c

View file

@ -1373,7 +1373,7 @@ jQuery.extend({
}); });
jQuery.swap( e, old, function() { jQuery.swap( e, old, function() {
if (jQuery.css(e,"display") != "none") { if ( jQuery(e).is(':visible') ) {
oHeight = e.offsetHeight; oHeight = e.offsetHeight;
oWidth = e.offsetWidth; oWidth = e.offsetWidth;
} else { } else {
@ -1383,14 +1383,14 @@ jQuery.extend({
visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0" visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
}).appendTo(e.parentNode)[0]; }).appendTo(e.parentNode)[0];
var parPos = jQuery.css(e.parentNode,"position"); var parPos = jQuery.css(e.parentNode,"position") || "static";
if ( parPos == "" || parPos == "static" ) if ( parPos == "static" )
e.parentNode.style.position = "relative"; e.parentNode.style.position = "relative";
oHeight = e.clientHeight; oHeight = e.clientHeight;
oWidth = e.clientWidth; oWidth = e.clientWidth;
if ( parPos == "" || parPos == "static" ) if ( parPos == "static" )
e.parentNode.style.position = "static"; e.parentNode.style.position = "static";
e.parentNode.removeChild(e); e.parentNode.removeChild(e);