mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Offset: Round offset value for the sake of floating errors
IE10+ may return not exactly the offset.top value set in an offset callback if parent has fractional top offset itself. Checking for being close to the desired result fixes the test error. Fixes gh-2147
This commit is contained in:
parent
555a50d340
commit
62ae2d0fb7
@ -453,7 +453,8 @@ testIframe( "dimensions/documentLarge", "window vs. large document", function( j
|
||||
});
|
||||
|
||||
test( "allow modification of coordinates argument (gh-1848)", 1, function() {
|
||||
var element = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
|
||||
var offsetTop,
|
||||
element = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
|
||||
|
||||
element.offset(function( index, coords ) {
|
||||
coords.top = 100;
|
||||
@ -461,7 +462,9 @@ test( "allow modification of coordinates argument (gh-1848)", 1, function() {
|
||||
return coords;
|
||||
});
|
||||
|
||||
equal( element.offset().top, 100, "coordinates are modified" );
|
||||
offsetTop = element.offset().top;
|
||||
ok( Math.abs(offsetTop - 100) < 0.02,
|
||||
"coordinates are modified (got offset.top: " + offsetTop + ")");
|
||||
});
|
||||
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user