Opened 12 years ago

Closed 12 years ago

#3378 closed defect (fixed)

dojo.contentBox incorrectly uses clientWidth/Height instead of offsetWidth/Height

Reported by: Douglas Hays Owned by: Douglas Hays
Priority: high Milestone: 0.9beta
Component: Core Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

dojo._getContentBox uses node.clientWidth and subtracts off the padding size. This is incorrect since clientWidth=0 in IE6 when width has not been explicitly set and always in FF2 for inline elements.
The correct function would be to use offsetWidth and subtract off padding and border.

Attachments (1)

3378.html (629 bytes) - added by Douglas Hays 12 years ago.
tiny example showing problem

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by Douglas Hays

Attachment: 3378.html added

tiny example showing problem

comment:1 Changed 12 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [9052]) Fixes #3378. Change clientWidth/Height to offsetWidth/Height in _getContentBox and adjust calculations accordingly.

comment:2 Changed 12 years ago by sjmiles

Resolution: fixed
Status: closedreopened

The original code explicitly used clientWidth/Height so that scrollbars are accounted for. You have just traded one defect for another.

comment:3 Changed 12 years ago by sjmiles

(In [9065]) Safari: add a null test and return a golem object from getComputedStyle if necessary. Refs #2686.

Adjust _setContentBox for TABLE and BUTTON, refs #3296.

Move left/top margin box adjustments out of _set and into _get. Refs #3297 and #3320.

Let _getContentBox fall back to offsetWidth/Height if clientWidth/Height are 0. Refs #3378.

comment:4 Changed 12 years ago by sjmiles

Resolution: fixed
Status: reopenedclosed

(In [9069]) Forgot to account for border when switch between client and offset sizing. Refs #3378.

Note: See TracTickets for help on using tickets.