Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contradiction about outerWidth on window between API documentation and migration guide #1199

Open
fredericDelaporte opened this issue Feb 17, 2022 · 0 comments

Comments

@fredericDelaporte
Copy link

fredericDelaporte commented Feb 17, 2022

outerwidth() documentation currently states:

This method is not applicable to window and document objects; for these, use .width() instead.

But the jQuery 3.0 migration guide states:

Breaking change: .outerWidth() or .outerHeight() on window includes scrollbar width/height

Calls 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 property window.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.

@fredericDelaporte fredericDelaporte changed the title Contradiction outerWidth documentation on window and migration guide. Contradiction about outerWidth documentation on window and migration guide. Feb 17, 2022
@fredericDelaporte fredericDelaporte changed the title Contradiction about outerWidth documentation on window and migration guide. Contradiction about outerWidth documentation on window and migration guide Feb 17, 2022
@fredericDelaporte fredericDelaporte changed the title Contradiction about outerWidth documentation on window and migration guide Contradiction about outerWidth on window between API documentation and migration guide Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant