-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix more IntersectionObserver issues.
Two spec issues here. w3c/IntersectionObserver#457: I think this is just a spec bug and I've made us match other browsers, but since the tests don't match the spec for now I've added them as .tentative.html w3c/IntersectionObserver#456: I've aligned with WebKit here. There was a (disabled) test for this which tests chrome behavior and which after this patch shouldn't be flaky. This is what was causing the assertion. Differential Revision: https://phabricator.services.mozilla.com/D93166 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1670327 gecko-commit: 2906a77771b3abcc15c2859052c0d170b263133d gecko-reviewers: hiro
- Loading branch information
1 parent
3dbd045
commit 6860d7a
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
intersection-observer/explicit-root-different-document.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!doctype html> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<link rel="help" href="https://github.com/w3c/IntersectionObserver/issues/457"> | ||
<style> | ||
div { | ||
width: 100px; | ||
height: 100px; | ||
background: blue; | ||
margin: 10px | ||
} | ||
</style> | ||
<div id="root"></div> | ||
<script> | ||
let t = async_test("IntersectionObserver reports a (non-intersecting) entry if different-document from the doc"); | ||
let doc = document.implementation.createHTMLDocument(""); | ||
let target = doc.createElement("div"); | ||
doc.body.appendChild(target); | ||
new IntersectionObserver( | ||
t.step_func_done(function(records) { | ||
assert_equals(records.length, 1); | ||
assert_false(records[0].isIntersecting); | ||
}), | ||
{ root: document.querySelector("#root") } | ||
).observe(target); | ||
</script> |
25 changes: 25 additions & 0 deletions
25
intersection-observer/not-in-containing-block-chain.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!doctype html> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<link rel="help" href="https://github.com/w3c/IntersectionObserver/issues/457"> | ||
<style> | ||
div { | ||
width: 100px; | ||
height: 100px; | ||
background: blue; | ||
margin: 10px | ||
} | ||
</style> | ||
<div id="target"></div> | ||
<div id="root"></div> | ||
<script> | ||
let t = async_test("IntersectionObserver reports a (non-intersecting) entry even if not in the containing block chain"); | ||
new IntersectionObserver( | ||
t.step_func_done(function(records) { | ||
assert_equals(records.length, 1); | ||
assert_false(records[0].isIntersecting); | ||
}), | ||
{ root: document.querySelector("#root") } | ||
).observe(document.querySelector("#target")); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters