[Webkit-unassigned] [Bug 219495] New: IntersectionObserver {root:document}: Getting a different rootBounds.top than both FF/Chrome for a scrolled window
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Dec 3 09:56:04 PST 2020
https://bugs.webkit.org/show_bug.cgi?id=219495
Bug ID: 219495
Summary: IntersectionObserver {root:document}: Getting a
different rootBounds.top than both FF/Chrome for a
scrolled window
Product: WebKit
Version: Safari 14
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: New Bugs
Assignee: webkit-unassigned at lists.webkit.org
Reporter: friedj at google.com
Hi webkit folks!
While working on a PR to update the w3c/IntersectionObserver polyfill with `root:document` support, I believe I may have found an issue with the WebKit implementation.
A `root:document` IntersectionObserver seems to be firing entries with a `rootBounds` that is relative to the scrollingElement.scrollTop. Both Chrome and FF always use `top:0` in this case.
According to the spec, I think the rootBounds should be equal to the document viewport (spec: https://www.w3.org/TR/intersection-observer/#intersectionobserver-root-intersection-rectangle).
Example:
```html
<!DOCTYPE html>
<html>
<head><title>IntersectionObserver RootBounds Test.</title></head>
<body>
<script>
function init() {
window.document.body.style = 'height: 2000px';
window.scrollTo(0, 110);
const io = new window.IntersectionObserver((e) => {
const p = document.createElement('p');
p.innerText = `rootBounds: ${JSON.stringify(e[0].rootBounds)}`;
document.body.appendChild(p);
}, {root: document});
io.observe(document.querySelector('body'));
}
window.addEventListener('DOMContentLoaded', init);
</script>
</body>
</html>
```
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20201203/55cefc38/attachment.htm>
More information about the webkit-unassigned
mailing list