This is ridiculous, but per the jQuery documentation:
Note that
.width()
will always return the content width, regardless of the value of the CSSbox-sizing
property. As of jQuery 1.8, this may require retrieving the CSS width plusbox-sizing
property and then subtracting any potential border and padding on each element when the element hasbox-sizing: border-box
. To avoid this penalty, use.css( "width" )
rather than.width()
.