This could be a bug in earlier versions of jQuery, down to this Github PR: https://github.com/jquery/jquery/pull/3741
Although it’s now 2019, I had to use jQuery 1.12.4 and I noticed that calculating the width of the hidden (hidden by the parent) element was always 100.
By debugging, I found that the externalWidth jQuery function (similar to innerHeight, innerWidth, height, width, outerHeight and outerWidth) would call width cssHook, which in turn would call getWidthOrHeight (). getWidthOrHeight () can get the width in%, which is then returned as is. The width function does not check what was returned, and passes it through parseFloat, resulting in a value of 100% becomes 100.
SP193 May 01, '19 at 8:05 2019-05-01 08:05
source share