]> source.dussan.org Git - jquery.git/commitdiff
Fixe dimensions tests. No core code changes. Supplements #11856
authorMike Sherov <mike.sherov@gmail.com>
Wed, 6 Jun 2012 21:06:03 +0000 (17:06 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Wed, 6 Jun 2012 21:06:03 +0000 (17:06 -0400)
src/dimensions.js
test/unit/dimensions.js

index 172df647d96a40b7bf6bf7e93825ff887992e9d6..dc7b4ceb497458ae20c4c4b948f0e0292a8388f3 100644 (file)
@@ -24,7 +24,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
                                        doc = elem.documentElement;
 
                                        // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
-                                       // unfortunately, this causes bug #3838 in IE6 only, but there is currently no good, small way to fix it.
+                                       // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
                                        return Math.max(
                                                elem.body[ scrollProp ], doc[ scrollProp ],
                                                elem.body[ offsetProp ], doc[ offsetProp ],
index ed065f3c784f76a1d2064d33ad30443b340f07e1..a7463ff2837f2c78d483f1722a55ae84997ff7e4 100644 (file)
@@ -415,10 +415,16 @@ test("setters with and without box-sizing:border-box", function(){
 });
 
 testIframe( "dimensions/documentSmall", "window vs. small document", function( jQuery, window, document ) {
-       expect(2);
+       // this test is practically tautological, but there is a bug in IE8
+       // with no simple workaround, so this test exposes the bug and works around it
+       if ( document.body.offsetWidth >= document.documentElement.offsetWidth ) {
+               expect( 2 );
 
-       equal( jQuery( document ).height(), jQuery( window ).height(), "document height matches window height" );
-       equal( jQuery( document ).width(), jQuery( window ).width(), "document width matches window width" );
+               equal( jQuery( document ).height(), jQuery( window ).height(), "document height matches window height" );
+               equal( jQuery( document ).width(), jQuery( window ).width(), "document width matches window width" );
+       } else {
+               expect( 0 );
+       }
 });
 
 testIframe( "dimensions/documentLarge", "window vs. large document", function( jQuery, window, document ) {