jquery / jquery/api.jquery.com
Contradiction about outerWidth on window between API documentation and migration guide
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 325
- Forks
- 260
- PR merge metrics
- No merged PRs in 30d
Description
outerwidth() documentation currently states:
This method is not applicable to
windowanddocumentobjects; for these, use.width()instead.
But the jQuery 3.0 migration guide states:
Breaking change:
.outerWidth()or.outerHeight()onwindowincludes scrollbar width/heightCalls to
$(window).width()return the "content width" which excludes any scrollbars that the browser has added if the content exceeds the height of the element. This is different from the width that CSS uses for media queries, which includes the width of the scrollbars. In order to provide a measure that is equivalent to the CSS media query concept of width, the$(window).outerWidth()method now returns the width including scrollbar width. This is equivalent to the DOM propertywindow.innerWidth. The same applies for.outerHeight().
So it seems to me either the API documentation is obsolete about outerWidth() not being applicable to window, or the migration guide is wrong telling us to call outerWidth() on window to get its "CSS width". This is confusing.
There is the same trouble with .outerHeight() documentation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the outerWidth and outerHeight API documentation alongside the jQuery 3.0 migration guide section on window scrollbar dimensions. Determine which statements conflict and update the documentation so the behavior of these methods on window is described consistently with the migration guide. Confirm that both outerWidth() and outerHeight() are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100