Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* WebKit export of https://bugs.webkit.org/show_bug.cgi?id=191975
* Intersection Observer: rootMargin: '' gives weird results
  • Loading branch information
alijuma authored and fred-wang committed Nov 28, 2018
1 parent a82d438 commit 3be4e5e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions intersection-observer/empty-root-margin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
#target {
width: 100px;
height: 100px;
background-color: green;
}
</style>

<div id="target"></div>

<script>
var target = document.getElementById("target");
async_test((t) => {
var observer = new IntersectionObserver(t.step_func_done((entries) => {
var rootBounds = entries[0].rootBounds;
assert_equals(rootBounds.left, 0);
assert_equals(rootBounds.right, document.documentElement.clientWidth);
assert_equals(rootBounds.top, 0);
assert_equals(rootBounds.bottom, document.documentElement.clientHeight);
observer.disconnect();
}), { rootMargin: "" });
observer.observe(document.getElementById("target"));
}, "An empty rootMargin string is interpreted as a margin of size zero");
</script>

0 comments on commit 3be4e5e

Please sign in to comment.