dist/jquery.documentsize.js
function getWindowInnerSize ( dimension, _window ) {
        var size =  ( _window || window ).visualViewport ?
                    ( _window || window ).visualViewport[ dimension.toLowerCase() ] :
                    ( _window || window )[ "inner" + dimension];

        // Check for fractions. Exclude undefined return values in browsers which don't support window.innerWidth/Height.
        if ( size ) checkForFractions( size );
        return size;
    }
function getWindowInnerSize ( dimension, _window ) {
        var size =  ( _window || window ).visualViewport ?
                    ( _window || window ).visualViewport[ dimension.toLowerCase() ] :
                    ( _window || window )[ "inner" + dimension];

        // Check for fractions. Exclude undefined return values in browsers which don't support window.innerWidth/Height.
        if ( size ) checkForFractions( size );
        return size;
    }
function getWindowInnerSize ( dimension , _window ) { var size = ( _window || window ) . visualViewport ? ( _window || window ) . visualViewport [ dimension . toLowerCase ( ) ] : ( _window || window ) [ "inner" + dimension ] ; // Check for fractions. Exclude undefined return values in browsers which don't support window.innerWidth/Height. if ( size ) checkForFractions ( size ) ; return size ; }
Returns window.visualViewport.width if available, or window.innerWidth otherwise, for width. Likewise, it
returns window.visualViewport.height or window.innerHeight for height. The dimension argument determines whether
width or height is returned.

Along the way, the return value is examined to see if the browser supports sub-pixel accuracy (floating-point
values).

If the visualViewport API is available, it is preferred over window.innerWidth/Height. That's because Chrome,
from version 62, has changed the behaviour of window.innerWidth/Height, which used to return the size of the
visual viewport. In Chrome, it now returns the size of the layout viewport, breaking compatibility with all other
browsers and its own past behaviour. Other browsers may follow suit, though. See

- https://www.quirksmode.org/blog/archives/2017/09/chrome_breaks_v.html
- https://developers.google.com/web/updates/2017/09/visual-viewport-api
- https://bugs.chromium.org/p/chromium/issues/detail?id=767388#c8

@param   {string} dimension  must be "Width" or "Height" (upper case!)
@param   {Window} [_window=window]
@returns {number}
Returns window . visualViewport . width if available or window . innerWidth otherwise for width . Likewise it returns window . visualViewport . height or window . innerHeight for height . The dimension argument determines whether width or height is returned .