]> source.dussan.org Git - jquery.git/commitdiff
Fixes IE7 test suite. Keep the testElement attached and set necessary styles on it...
authortimmywil <timmywillisn@gmail.com>
Wed, 28 Sep 2011 15:30:38 +0000 (11:30 -0400)
committertimmywil <timmywillisn@gmail.com>
Wed, 28 Sep 2011 15:30:38 +0000 (11:30 -0400)
src/support.js
test/unit/offset.js
test/unit/support.js

index 6a77e449cbfb5fad2aad221e5040a49dc61018ee..dc93164a42661681608a5380bb0fea074babc8b4 100644 (file)
@@ -230,7 +230,6 @@ jQuery.support = (function() {
 
        // Remove the body element we added
        testElement.innerHTML = "";
-       testElementParent.removeChild( testElement );
 
        // Technique from Juriy Zaytsev
        // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
@@ -255,12 +254,15 @@ jQuery.support = (function() {
        }
 
        // Determine fixed-position support early
+       testElement.style.position = "static";
+       testElement.style.top = "0px";
+       testElement.style.marginTop = "1px";
        offsetSupport = (function( body, container ) {
 
                var outer, inner, table, td, supports,
                        bodyMarginTop = parseFloat( body.style.marginTop ) || 0,
-                       ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;",
-                       style = "style='" + ptlm + "margin:0;border:5px solid #000;padding:0;'",
+                       ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",
+                       style = "style='" + ptlm + "border:5px solid #000;padding:0;'",
                        html = "<div " + style + "><div></div></div>" +
                                                        "<table " + style + " cellpadding='0' cellspacing='0'>" +
                                                        "<tr><td></td></tr></table>";
@@ -296,6 +298,7 @@ jQuery.support = (function() {
        })( testElement, div );
 
        jQuery.extend( support, offsetSupport );
+       testElementParent.removeChild( testElement );
 
        // Null connected elements to avoid leaks in IE
        testElement = fragment = select = opt = body = marginDiv = div = input = null;
index adb8a9ecabde387f88eaa7be8a7a83f0a8849ed5..a31d058a4bca001bcfd79c02e889dc26256d075b 100644 (file)
@@ -401,8 +401,8 @@ testoffset("scroll", function( jQuery, win ) {
 testoffset("body", function( jQuery ) {
        expect(2);
 
-       equals( jQuery("body").offset().top, 0, "jQuery('#body').offset().top" );
-       equals( jQuery("body").offset().left, 0, "jQuery('#body').offset().left" );
+       equals( jQuery("body").offset().top, 1, "jQuery('#body').offset().top" );
+       equals( jQuery("body").offset().left, 1, "jQuery('#body').offset().left" );
 });
 
 test("Chaining offset(coords) returns jQuery object", function() {
index 4733b2529ede4c40cbf8dd37ed89ba4d1a0a1824..50a40e4a05f0826303f31c4185f892ada5e3ef0f 100644 (file)
@@ -47,7 +47,7 @@ supportIFrameTest( "body background is not lost if set prior to loading jQuery (
        }
        for ( i in support ) {
                if ( !( i in jQuery.support ) ) {
-                       ok = false;
+                       passed = false;
                        strictEqual( src[ i ], dest[ i ], "Unexpected property: " + i );
                }
        }