22 <div class=spacer
></div>
25 <script src=
"../../resources/js-test.js"></script>
27 description("Verifies that nan scroll position works correctly.");
29 function scrollToNonFinite(x
, y
)
31 window
.scrollTo(100, 100);
32 window
.scrollTo(x
, y
);
33 shouldBe('window.scrollY', "0");
34 shouldBe('window.scrollX', "0");
36 window
.scrollTo(100, 100);
37 window
.scrollTo({top
: y
, left
: x
});
38 shouldBe('window.scrollY', "0");
39 shouldBe('window.scrollX', "0");
42 function scrollByNonFinite(x
, y
)
44 window
.scrollTo(100, 100);
45 window
.scrollBy(x
, y
);
46 shouldBe('window.scrollY', "100");
47 shouldBe('window.scrollX', "100");
49 window
.scrollTo(100, 100);
50 window
.scrollBy({top
: y
, left
: x
});
51 shouldBe('window.scrollY', "100");
52 shouldBe('window.scrollX', "100");
55 function scrollTopNonFinite(y
)
57 scroller
.scrollTop
= 1;
58 shouldBe("scroller.scrollTop", "1");
59 scroller
.scrollTop
= y
;
60 shouldBe("scroller.scrollTop", "0");
63 function scrollLeftNonFinite(x
)
65 scroller
.scrollLeft
= 1;
66 shouldBe("scroller.scrollLeft", "1");
67 scroller
.scrollLeft
= x
;
68 shouldBe("scroller.scrollLeft", "0");
73 window
.scrollTo(1, 1);
74 shouldBe('window.scrollY', "1");
75 shouldBe('window.scrollX', "1");
77 scrollToNonFinite(window
.NaN
, window
.NaN
);
78 scrollToNonFinite(window
.Infinity
, window
.Infinity
);
79 scrollToNonFinite(0, window
.Infinity
);
80 scrollToNonFinite(-window
.Infinity
, -window
.Infinity
);
82 scrollByNonFinite(window
.NaN
, window
.NaN
);
83 scrollByNonFinite(window
.Infinity
, window
.Infinity
);
84 scrollByNonFinite(0, window
.Infinity
);
85 scrollByNonFinite(-window
.Infinity
, -window
.Infinity
);
87 scrollTopNonFinite(window
.NaN
);
88 scrollTopNonFinite(window
.Infinity
);
89 scrollTopNonFinite(-window
.Infinity
);
91 scrollLeftNonFinite(window
.NaN
);
92 scrollLeftNonFinite(window
.Infinity
);
93 scrollLeftNonFinite(-window
.Infinity
);
97 if (window
.eventSender
)