mirror of
https://github.com/servo/servo.git
synced 2025-09-23 05:10:09 +01:00
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:
parent
c017420ee7
commit
994d767ae5
3 changed files with 55 additions and 1 deletions
|
@ -462,7 +462,7 @@ impl HTMLElementMethods<crate::DomTypeHolder> for HTMLElement {
|
|||
|
||||
/// <https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent>
|
||||
fn GetOffsetParent(&self) -> Option<DomRoot<Element>> {
|
||||
if self.is_body_element() || self.is::<HTMLHtmlElement>() {
|
||||
if self.is::<HTMLBodyElement>() || self.upcast::<Element>().is_root() {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue