diff options
author | timmywil <tim.willison@thisismedium.com> | 2011-04-01 21:13:01 -0400 |
---|---|---|
committer | timmywil <tim.willison@thisismedium.com> | 2011-04-03 19:13:41 -0400 |
commit | 5fc2281fcc83783b86647a5a86380b9ac21e7f79 (patch) | |
tree | 61cc874de546f40c8905156296db4c2abc7281ff /src/attributes.js | |
parent | 1e9b3ef3d87a0934dec969ed469cd3cc9c910ae8 (diff) | |
download | jquery-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.js | 14 |
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 |