Open
Bug 1309427
Opened 8 years ago
Updated 4 years ago
Return normal values for 'offsetTop' and 'offsetLeft' instead of 0 on descendant <body> elements
Categories
(Core :: DOM: Core & HTML, defect, P5)
Tracking
()
NEW
People
(Reporter: coreyf, Unassigned)
References
()
Details
Comment 1•8 years ago
|
||
The point of this issue is to only return 0 for the first <body> element child of the root <html> element, but handle subsequent <body> elements like normal elements.
I.e. when calling 'offsetTop' and 'offsetLeft' on *descendant* <body> elements, you should get their offsets returned instead of 0.
I've attached the test case of the GitHub issue as data URL.
Sebastian
Component: General → DOM: Core & HTML
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → All
Summary: Firefox should honor "the HTML body element" in `offsetTop` → Return normal values for 'offsetTop' and 'offsetLeft' instead of 0 on descendant <body> elements
Version: unspecified → 52 Branch
Comment 2•8 years ago
|
||
The relevant parts in the spec. are here:
https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsettop
https://drafts.csswg.org/cssom-view/#the-html-body-element
Sebastian
Comment 4•8 years ago
|
||
Not urgent at all, in my opinion. This situation is not exactly common.
Chances are the fix is to change this block in GetOffsetRect:
if (content && (content->IsHTMLElement(nsGkAtoms::body) ||
content == docElement)) {
parent = frame;
to test content == GetComposedDoc()->GetBodyElement() instead of the IsHTMLElement(nsGkAtoms::body) thing.
But note that even if that's done the testcase will still alert 0 for the offsetTop, because the inner <body> in it is not offset vertically from its offsetParent (the outer <body>). It should start alerting a nonzero offsetLeft, though.
Flags: needinfo?(bzbarsky)
Comment 5•8 years ago
|
||
Note that there is one other content->IsHTMLElement(nsGkAtoms::body) that should probably become a test against GetComposedDoc()->GetBodyElement(), which should probably get cached in the method on the stack like the GetRootElement() is right now.
Updated•8 years ago
|
Priority: -- → P3
Comment 6•4 years ago
|
||
Bulk-downgrade of unassigned, >=3 years untouched DOM/Storage bug's priority.
If you have reason to believe this is wrong, please write a comment and ni :jstutte.
Severity: normal → S4
Priority: P3 → P5
You need to log in
before you can comment on or make changes to this bug.
Description
•