diff options
author | timmywil <tim.willison@thisismedium.com> | 2011-04-11 23:59:12 -0400 |
---|---|---|
committer | timmywil <tim.willison@thisismedium.com> | 2011-04-11 23:59:12 -0400 |
commit | 98da6b13bcc77dc117c68686ef4ed305bd83d400 (patch) | |
tree | f455e1879c375ef87df876e6962b1c101a6313b5 /src/support.js | |
parent | 2b70893928035d53f46575003197e4a1fa52a844 (diff) | |
download | jquery-98da6b13bcc77dc117c68686ef4ed305bd83d400.tar.gz jquery-98da6b13bcc77dc117c68686ef4ed305bd83d400.zip |
Fixes unit/css.js test fail in Safari 5. support.js test was passing erroneously due to the body to which the div was attached having a width of 0
Diffstat (limited to 'src/support.js')
-rw-r--r-- | src/support.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/support.js b/src/support.js index 34960505a..6b19c0830 100644 --- a/src/support.js +++ b/src/support.js @@ -8,6 +8,7 @@ jQuery.support = (function() { select, opt, input, + marginDiv, support, fragment, body, @@ -190,10 +191,12 @@ jQuery.support = (function() { // Fails in WebKit before Feb 2011 nightlies // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right if ( document.defaultView && document.defaultView.getComputedStyle ) { - div.style.width = "1px"; - div.style.marginRight = "0"; + marginDiv = document.createElement('div'); + marginDiv.style.width = "0"; + marginDiv.style.marginRight = "0"; + div.appendChild( marginDiv ); support.reliableMarginRight = - ( parseInt( document.defaultView.getComputedStyle(div).marginRight, 10 ) || 0 ) === 0; + ( parseInt( document.defaultView.getComputedStyle( marginDiv ).marginRight, 10 ) || 0 ) === 0; } // Remove the body element we added |