Automatic update from web-platform-tests Do not synchronously generate IntersectionObserver notifications Prior to this CL, we would synchronously generate a not-intersecting notification when a target element was removed from the DOM. That doesn't match the spec -- there is no affordance for generating notifications outside of the "update the rendering" steps. This CL removes all the synchronous forced computation of intersections. It makes IntersectionObserverController continue tracking disconnected targets until they have a chance to issue a "not-intersecting" notification during a rendering update. Bug: chromium:40914013 Change-Id: I332dc4e95dc9cffbe7d05ec63eb3cd6122c431a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7038511 Reviewed-by: Philip Rogers <pdr@chromium.org> Commit-Queue: Stefan Zager <szager@chromium.org> Cr-Commit-Position: refs/heads/main@{#1531750} -- wpt-commits: ca587879e05348d19e15627d9d5b6a2be0b5caf2 wpt-pr: 55459
36 lines
1.0 KiB
HTML
36 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="./resources/intersection-observer-test-utils.js"></script>
|
|
|
|
<style>
|
|
pre, #log {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 200px;
|
|
}
|
|
</style>
|
|
|
|
<div id="target">Hello, world!</div>
|
|
|
|
<script>
|
|
promise_test(async function(t) {
|
|
let entries = [];
|
|
let target = document.getElementById("target");
|
|
let observer = new IntersectionObserver(function(changes) {
|
|
entries = entries.concat(changes);
|
|
});
|
|
observer.observe(target);
|
|
await waitForNotification();
|
|
assert_equals(entries.length, 1);
|
|
assert_true(entries[0].isIntersecting);
|
|
target.remove();
|
|
document.body.appendChild(target);
|
|
await waitForNotification();
|
|
assert_equals(entries.length, 1);
|
|
assert_true(entries[0].isIntersecting);
|
|
}, "An element that is removed and reinserted without an intervening" +
|
|
" rendering update doesn't generate a 'not-intersecting' notification.");
|
|
</script>
|