Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTMLElement::GetOffsetParent should correctly check if root element #10521

Open
frewsxcv opened this issue Apr 11, 2016 · 3 comments
Open

HTMLElement::GetOffsetParent should correctly check if root element #10521

frewsxcv opened this issue Apr 11, 2016 · 3 comments

Comments

@frewsxcv
Copy link
Member

@frewsxcv frewsxcv commented Apr 11, 2016

Spec link

Relevant code

Currently, we just check if the HTMLElement being called on is an HTMLHtmlElement. This is insufficient as an <html> can (incorrectly) appear anywhere in the tree and is not necessarily the root element. We should instead call Element::root_element and compare that value.

@frewsxcv
Copy link
Member Author

@frewsxcv frewsxcv commented Apr 11, 2016

Ideally there'd be a regression test for this, but I don't know how difficult that would be to write.

@notriddle
Copy link
Contributor

@notriddle notriddle commented Apr 13, 2016

Like this, I assume.

<!doctype html>
<div id=cont style="position:relative"></div>
<script>
var h = document.createElement("html");
var cont = document.getElementById("cont");
cont.appendChild(h);
assertEqual(h.offsetParent, cont);
cont.innerHTML = "PASS";
function assertEqual(a, b) {
    if (a !== b) {
        cont.innerHTML = "FAIL";
        throw new Exception("FAIL");
    }
}
</script>
@nox
Copy link
Member

@nox nox commented Oct 1, 2017

This is still not done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.