Closed
Bug 35276
Opened 25 years ago
Closed 25 years ago
offsetWidth/Height not in sync with style.width/height
Categories
(Core :: DOM: CSS Object Model, defect, P3)
Tracking
()
VERIFIED
FIXED
M16
People
(Reporter: joe, Assigned: jst)
Details
(Whiteboard: [HAVE FIX])
Attachments
(1 file)
|
800 bytes,
text/html
|
Details |
Apparently the offsetWidth and offsetHeight properties are not updated
synchronously whenever .style.width and .style.height are modified. This is a
real problem because it essentially makes these properties meaningless.
As a practical example, in a DHTML animation, if an element's size is
constantly changing, and the script wants to rely on .offsetWidth
and .offsetHeight to determine the current size, the obviously cannot do so.
However, relying on the style properties is also not a good idea because you
don't know if the element's size was set inline (and we don't have
getComputedStyle() yet either, to find out the cascaded size).
| Reporter | ||
Comment 1•25 years ago
|
||
Updated•25 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Comment 2•25 years ago
|
||
Joe, could you test if adding
user_pref("layout.reflow.async.afterDocLoad", false);
to your prefs.js fixes this?
| Reporter | ||
Comment 3•25 years ago
|
||
Adding that line to prefs.js does in fact fix the bug. Will this be a permanent
addition to the code?
| Assignee | ||
Comment 4•25 years ago
|
||
No, it will not, and it's not even possible to do that any more (or adding that
line doesn't change anything any more). But it does confirm my theory tho so
thanks for testing. The problem is that modifying the dom tells gecko to reflow
the changed content but this is done asynchronously so if you ask for
style.width immediately after you change something you probably won't see the
changes. Now I just haveto figure out how to get arround this, we probably
need to add code that flushes all pending reflows before returning style
properties through the dom, I'll look into this...
Status: NEW → ASSIGNED
| Assignee | ||
Comment 5•25 years ago
|
||
I've got a fix for this, I'll land it as soon as I can (tomorrow probably)...
Whiteboard: [HAVE FIX]
Target Milestone: --- → M16
| Assignee | ||
Comment 6•25 years ago
|
||
The fix is checked in, marking FIXED.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Updated•24 years ago
|
Component: DOM Level 2 → DOM Style
Comment 7•24 years ago
|
||
Taking QA Contact on all open or unverified DOM Style bugs...
QA Contact: vidur → ian
Description
•