script: Return None for offsetParent on root <html> and all <body> elements (#39397)

We were returning null for all `<html>` elements, but now we will check
for the root element instead.

We were also returning null for "the body element", now we will return
null for all `<body>` elements even if they aren't "the body element".
This part diverges from the spec, but matches what all browsers do.
https://github.com/w3c/csswg-drafts/issues/12834

Testing: Adding new test
Fixes: #10521

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Oriol Brufau 2025-09-19 21:38:12 +02:00 committed by GitHub
parent c017420ee7
commit 994d767ae5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 55 additions and 1 deletions

View file

@ -631326,6 +631326,13 @@
{}
]
],
"offsetParent-body-and-html.html": [
"ed83b317088c01e6ff23025b12f20a0144f897ed",
[
null,
{}
]
],
"offsetParent-fixed.html": [
"a2c4255a77729066fedc1ba21101cb123a396380",
[