Open Bug 434678 Opened 17 years ago Updated 3 months ago

A position fixed node's offsetParent should return null

Categories

(Core :: DOM: CSS Object Model, defect)

defect

Tracking

()

People

(Reporter: bugzilla, Unassigned)

References

()

Details

(Keywords: testcase)

CSSOM View Module, offsetParent attribute states that " If any of the following holds true return null and terminate this algorithm: (...) The element’s computed value of the position property is fixed. " https://www.w3.org/TR/cssom-view/#dom-htmlelement-offsetparent Steps to reproduce: 1- Load provided URL 2- Click the [return document.getElementById("PositionFixedElem").offsetParent] button Actual results in Firefox 2.0.0.14 rv: 1.8.1.14 build 20080404 and in Firefox 3.0 RC1 rv: 1.9 build 2008051206 under XP Pro SP3: document.getElementById("PositionFixedElem").offsetParent = [object HTMLBodyElement] Expected results: document.getElementById("PositionFixedElem").offsetParent = null Internet Explorer 7, Internet Explorer 8 beta 1 and Opera 9.50 will return null. Component set to DOM: CSSOM : please change it if that's wrong. I have searched for a duplicate and did not find one. I have not checked the testcase with a trunk nightly build: so version 1.9.0 for now.
I also get the actual results with Seamonkey 2.0a1pre rv:1.9 build 2008051902. So, changing version to Trunk
Version: 1.9.0 Branch → Trunk
Obviously this also means that there is currently no way to compute actual offset (position) of an elment with position:fixed. offsetTop: "If the offsetParent of element A is null or the HTML body element return the distance, as number of CSS pixels, between the top border edge of element A and the canvas origin and stop this algorithm." Currently the offsetTop property of position:fixed element always contains 0.
QA Contact: general → style-system
Last time I checked, Safari 3.1.1 and IE 8 passed this test. Now, Chrome 25.0.1364.172, Konqueror 4.10.1 and Opera 12.14 passes this test. Firefox 19.0.2 fails this test. Confirming
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: x86 → All
" If any of the following holds true return null and terminate this algorithm: (...) The element’s computed value of the position property is fixed. " https://www.w3.org/TR/cssom-view/#dom-htmlelement-offsetparent now written at 7. Extensions to the HTMLElement Interface https://www.w3.org/TR/cssom-view/#extensions-to-the-htmlelement-interface
I have slightly edited the test to meet the current version of the spec. CSSOM View Module W3C Working Draft, 17 March 2016 7. Extensions to the HTMLElement Interface https://www.w3.org/TR/cssom-view-1/#dom-htmlelement-offsetparent - - - - - - - - (In reply to Jaroslav Zaruba from comment #3) > Obviously this also means that there is currently no way to compute actual > offset (position) of an elment with position:fixed. Correct. > offsetTop: > "If the offsetParent of element A is null or the HTML body element return > the distance, as number of CSS pixels, between the top border edge of > element A and the canvas origin and stop this algorithm." > > Currently the offsetTop property of position:fixed element always contains 0. In a test page, I am able to get the offsetTop property of a 'position: fixed' element (which is not 0) with Firefox 47 and Chrome 51. But the spec says it should not be possible since offsetParent of a 'position: fixed' element should be null.
Keywords: testcase

I would like to link https://bugs.webkit.org/show_bug.cgi?id=212372
This is the opposite bug in webkit.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.