Commit cd63e9c6 authored by Michał Gołębiowski's avatar Michał Gołębiowski

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.

(cherry-picked from 62ae2d0fb7ac011bf2ad778f8158de408e785927)

Fixes gh-2147
parent 34f25631
......@@ -468,7 +468,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;
......@@ -476,7 +477,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 + ")");
});
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment