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

This commit is contained in:
timmywil 2011-04-11 23:59:12 -04:00
parent 2b70893928
commit 98da6b13bc
2 changed files with 7 additions and 4 deletions

View file

@ -8,6 +8,7 @@ jQuery.support = (function() {
select, select,
opt, opt,
input, input,
marginDiv,
support, support,
fragment, fragment,
body, body,
@ -190,10 +191,12 @@ jQuery.support = (function() {
// Fails in WebKit before Feb 2011 nightlies // Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( document.defaultView && document.defaultView.getComputedStyle ) { if ( document.defaultView && document.defaultView.getComputedStyle ) {
div.style.width = "1px"; marginDiv = document.createElement('div');
div.style.marginRight = "0"; marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.appendChild( marginDiv );
support.reliableMarginRight = 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 // Remove the body element we added

View file

@ -375,5 +375,5 @@ test("marginRight computed style (bug #3333)", function() {
marginRight: 0 marginRight: 0
}); });
equals($div.css("marginRight"), "0px"); equals($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block");
}); });