Closed
Bug 400258
Opened 17 years ago
Closed 5 years ago
offsetLeft includes borders when box-sizing is border-box
Categories
(Core :: DOM: CSS Object Model, defect, P2)
Tracking
()
RESOLVED
FIXED
mozilla71
Tracking | Status | |
---|---|---|
firefox71 | --- | fixed |
People
(Reporter: marcus, Assigned: MatsPalmgren_bugz)
References
()
Details
Attachments
(4 files)
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.7 (like Gecko) (Debian) Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070723 Iceweasel/2.0.0.6 The offsetParent's border is usually not included in the offsetLeft value. However if the parent's -moz-box-sizing is "border-box", then the border _is_ included. This is contrary to how MSIE 7 and WebKit behave (see http://bugs.webkit.org/show_bug.cgi?id=15539). Reproducible: Always
Reporter | ||
Updated•17 years ago
|
Version: unspecified → 1.8 Branch
Reporter | ||
Comment 1•17 years ago
|
||
This shows the values that are included in the offsetLeft of the div2 element. The box turns red if the test fails. Expected results are 384,384 (div2 margin plus div2 top/left). (Note that the bug equally affects offsetTop.)
Reporter | ||
Comment 2•17 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
Spec: https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetleft
I don't see any special handling for box-sizing: border-box
in the spec so this definitely looks like a bug to me.
Incidentally, it also makes us erroneously fail some WPTs that use offsetLeft/offsetTop
to verify the correct layout.
https://searchfox.org/mozilla-central/search?q=checkLayout(
Yikes, I can't believe this bug has been open for 12 years without anyone investigating it...
Assignee: nobody → mats
Status: UNCONFIRMED → NEW
Component: Layout: Block and Inline → DOM: CSS Object Model
Ever confirmed: true
OS: Linux → All
Priority: -- → P2
Hardware: x86 → All
Assignee | ||
Comment 4•5 years ago
|
||
This is what the spec says and is compatible with other UAs.
https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetleft
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2a9d67d7b2d2 Use the padding edge as the origin for offsetLeft/offsetTop also for box-sizing:border-box boxes. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/19057 for changes under testing/web-platform/tests
Can't merge web-platform-tests PR due to failing upstream checks: Github PR https://github.com/web-platform-tests/wpt/pull/19057 * Taskcluster (pull_request) (https://tools.taskcluster.net/task-group-inspector/#/XsiDFx-wS_mjFxqxKJhgNw)
Flags: needinfo?(mats)
Comment 8•5 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 5 years ago
status-firefox71:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Comment 9•5 years ago
|
||
Comment 10•5 years ago
|
||
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/autoland/rev/42cdcfe496d6 Move CSSOM test to load Ahem as a webfont, r=emilio
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Comment 12•5 years ago
|
||
bugherder |
Upstream PR merged by moz-wptsync-bot
Updated•2 years ago
|
Flags: needinfo?(MatsPalmgren_bugz)
You need to log in
before you can comment on or make changes to this bug.
Description
•