]> source.dussan.org Git - jquery.git/commitdiff
Fixes unit/css.js test fail in Safari 5. support.js test was passing erroneously... 318/head
authortimmywil <tim.willison@thisismedium.com>
Tue, 12 Apr 2011 03:59:12 +0000 (23:59 -0400)
committertimmywil <tim.willison@thisismedium.com>
Tue, 12 Apr 2011 03:59:12 +0000 (23:59 -0400)
src/support.js
test/unit/css.js

index 34960505ac03c7eed0ca19165f8a31912b953be8..6b19c0830016f72cdf9ff6d376472b1af0f76734 100644 (file)
@@ -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
index 08f50ef2575f6bf9ff4ca3dcfb1b59ec38e5e19d..b94c6a8d1e037b7c9ca31be405e618e509eef7ff 100644 (file)
@@ -375,5 +375,5 @@ test("marginRight computed style (bug #3333)", function() {
                marginRight: 0
        });
 
-       equals($div.css("marginRight"), "0px");
+       equals($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block");
 });