Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Breaking changes
getWidth(document)
andgetHeight(document)
no matter which box edge value you provide as the second argument, and that result is the width/height without the viewport scrollbar.body
element'sscrollWidth
/scrollHeight
in the calculations when deciding the max width/height for the document. This stemmed from the fact that while in quirks mode the main scrollbar (queryable via document.scrollingElement) could've been either thebody
's scrollbar or thedocumentElement
's scrollbar. However, in standards mode, the main scrolling element is always thedocumentElement
, which is why we don't include thebody
'sscrollWidth
/scrollHeight
anymore when trying to compute the max width and height for the document.scrollWidth
,scrollHeight
,clientWidth
,clientHeight
) only return rounded integers. To make the document width a bit more accurate in some scenarios we now also inlcude thedocumentElement
'sgetBoundingClientRect().width/height
in the calculations, which returns fractional pixel values.documentElement
scrollbar width/height:documentElement
, but in realitydocumentElement
can't actually have a scrollbar. Check it yourself, the scrollbar of thedocumentElement
is always outside the bounds ofdocumentElement
because it's actually thewindow
's scrollbar , so we always return0
from now on.window.getComputedStyle(elem).width/height
, which's precision varies per browser, but still always returns values with at least 2 decimal precision. In practice you probably won't notice the difference compared to the original approach where we started peeling the layers off ofelem.getBoundingClientRect().width/height
, but it's still a breaking change compared to the previous behavior.