mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Fixes IE7 test suite. Keep the testElement attached and set necessary styles on it to fix the offset with margin test.
This commit is contained in:
parent
649823de18
commit
3661835101
@ -230,7 +230,6 @@ jQuery.support = (function() {
|
|||||||
|
|
||||||
// Remove the body element we added
|
// Remove the body element we added
|
||||||
testElement.innerHTML = "";
|
testElement.innerHTML = "";
|
||||||
testElementParent.removeChild( testElement );
|
|
||||||
|
|
||||||
// Technique from Juriy Zaytsev
|
// Technique from Juriy Zaytsev
|
||||||
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
|
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
|
||||||
@ -255,12 +254,15 @@ jQuery.support = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine fixed-position support early
|
// Determine fixed-position support early
|
||||||
|
testElement.style.position = "static";
|
||||||
|
testElement.style.top = "0px";
|
||||||
|
testElement.style.marginTop = "1px";
|
||||||
offsetSupport = (function( body, container ) {
|
offsetSupport = (function( body, container ) {
|
||||||
|
|
||||||
var outer, inner, table, td, supports,
|
var outer, inner, table, td, supports,
|
||||||
bodyMarginTop = parseFloat( body.style.marginTop ) || 0,
|
bodyMarginTop = parseFloat( body.style.marginTop ) || 0,
|
||||||
ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;",
|
ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",
|
||||||
style = "style='" + ptlm + "margin:0;border:5px solid #000;padding:0;'",
|
style = "style='" + ptlm + "border:5px solid #000;padding:0;'",
|
||||||
html = "<div " + style + "><div></div></div>" +
|
html = "<div " + style + "><div></div></div>" +
|
||||||
"<table " + style + " cellpadding='0' cellspacing='0'>" +
|
"<table " + style + " cellpadding='0' cellspacing='0'>" +
|
||||||
"<tr><td></td></tr></table>";
|
"<tr><td></td></tr></table>";
|
||||||
@ -296,6 +298,7 @@ jQuery.support = (function() {
|
|||||||
})( testElement, div );
|
})( testElement, div );
|
||||||
|
|
||||||
jQuery.extend( support, offsetSupport );
|
jQuery.extend( support, offsetSupport );
|
||||||
|
testElementParent.removeChild( testElement );
|
||||||
|
|
||||||
// Null connected elements to avoid leaks in IE
|
// Null connected elements to avoid leaks in IE
|
||||||
testElement = fragment = select = opt = body = marginDiv = div = input = null;
|
testElement = fragment = select = opt = body = marginDiv = div = input = null;
|
||||||
|
@ -401,8 +401,8 @@ testoffset("scroll", function( jQuery, win ) {
|
|||||||
testoffset("body", function( jQuery ) {
|
testoffset("body", function( jQuery ) {
|
||||||
expect(2);
|
expect(2);
|
||||||
|
|
||||||
equals( jQuery("body").offset().top, 0, "jQuery('#body').offset().top" );
|
equals( jQuery("body").offset().top, 1, "jQuery('#body').offset().top" );
|
||||||
equals( jQuery("body").offset().left, 0, "jQuery('#body').offset().left" );
|
equals( jQuery("body").offset().left, 1, "jQuery('#body').offset().left" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Chaining offset(coords) returns jQuery object", function() {
|
test("Chaining offset(coords) returns jQuery object", function() {
|
||||||
|
@ -47,7 +47,7 @@ supportIFrameTest( "body background is not lost if set prior to loading jQuery (
|
|||||||
}
|
}
|
||||||
for ( i in support ) {
|
for ( i in support ) {
|
||||||
if ( !( i in jQuery.support ) ) {
|
if ( !( i in jQuery.support ) ) {
|
||||||
ok = false;
|
passed = false;
|
||||||
strictEqual( src[ i ], dest[ i ], "Unexpected property: " + i );
|
strictEqual( src[ i ], dest[ i ], "Unexpected property: " + i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user