aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes.js
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-04-01 21:13:01 -0400
committertimmywil <tim.willison@thisismedium.com>2011-04-03 19:13:41 -0400
commit5fc2281fcc83783b86647a5a86380b9ac21e7f79 (patch)
tree61cc874de546f40c8905156296db4c2abc7281ff /src/attributes.js
parent1e9b3ef3d87a0934dec969ed469cd3cc9c910ae8 (diff)
downloadjquery-5fc2281fcc83783b86647a5a86380b9ac21e7f79.tar.gz
jquery-5fc2281fcc83783b86647a5a86380b9ac21e7f79.zip
- Added a hook to swap display none for width and height in browsers that do not sufficiently support get/setAttribute
Diffstat (limited to 'src/attributes.js')
-rw-r--r--src/attributes.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/attributes.js b/src/attributes.js
index f03985590..f29c340a3 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -446,6 +446,20 @@ if ( !jQuery.support.getSetAttribute ) {
return value;
}
};
+
+ // Retrieving the width/height attributes on an
+ // element with display: none returns 0 in ie6/7 (#5413)
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ get: function( elem ) {
+ var ret;
+ jQuery.swap( elem, { visibility: "hidden", display: "block" }, function() {
+ ret = elem.getAttribute( name );
+ });
+ return ret;
+ }
+ });
+ });
}
// Remove certain attrs if set to false