Closed Bug 398777 Opened 12 years ago Closed 12 years ago

Clearly document the differences and respective use cases for offsetWidth, clientWidth, and scrollWidth


(Developer Documentation :: General, defect)

Not set


(Not tracked)



(Reporter: Waldo, Unassigned)


There are three different properties for getting the "width" of a node in a document.  The differences between the three are not clearly described anywhere that I can tell, and if I were trying to decide which to use in a particular situation (bug 199692 comment 53), I really wouldn't know which to use.

I think it would be awesome if we clarified the exact behaviors of each of the three and how their values are affected by different combinations of CSS properties and ancestor element styles within each property's article.  I also think it would be awesome if we had an article specifically devoted to getting the width of a node which described when you'd want to use each of the different properties and why you wouldn't want to use the others.

Add some links to this on the pages documenting the various properties being discussed, and perhaps mention it more prominently in the DOM section of MDC, and I think you're golden.
Done.  Should have already done that but I just plain forgot; thanks for the reminder.
Closed: 12 years ago
Resolution: --- → FIXED
Component: Documentation Requests → Documentation
Component: Documentation → General
Product: Mozilla Developer Network → Developer Documentation
You need to log in before you can comment on or make changes to this bug.