You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if you want this to be reported (because of #4741) but .width() don't return the same value as .getBoundingClientRect() for html DOM nodes inside SVG. But I don't use SVG elements, but HTML elements inside foreign object. The size works but it return different value than getBoundingClientRect().
At least jQuery should work the same as native API for this case.
There are two types of issues, one with padding/margins/scrollbar that is way bigger because 1px in SVG is not the same as 1px on the screen (). But the main issue is that .width() returns completely wrong results, that's why my library thinks that the screen is much smaller (the long line wrapping is done in JavaScript).
Let me know if this is something you would like to handle/fix in jQuery and if you want simpler reproduction.
The text was updated successfully, but these errors were encountered:
Thanks for the report. However, jQuery .width() is supposed to return the computed CSS width of the element and not the actual size on the screen so the output is as expected.
This is so unnatural because the CSS dimensions seem to refer to viewBox and not regular pixel values. However, that's just an SVG quirk and I don't see a good way to address that while still being true to the docs. Especially that we don't fully support SVGs per https://github.com/jquery/jquery/wiki/Won't-Fix#svg-or-vml and the issue you linked.
Description
I'm not sure if you want this to be reported (because of #4741) but
.width()
don't return the same value as.getBoundingClientRect()
for html DOM nodes inside SVG. But I don't use SVG elements, but HTML elements inside foreign object. The size works but it return different value thangetBoundingClientRect()
.At least jQuery should work the same as native API for this case.
Link to test case
Here is a link to a demo that uses my library jQuery Terminal that is inside SVG.
https://codepen.io/jcubic/pen/abVJrob?editors=0010
Additional info
There are two types of issues, one with padding/margins/scrollbar that is way bigger because 1px in SVG is not the same as 1px on the screen (). But the main issue is that
.width()
returns completely wrong results, that's why my library thinks that the screen is much smaller (the long line wrapping is done in JavaScript).Let me know if this is something you would like to handle/fix in jQuery and if you want simpler reproduction.
The text was updated successfully, but these errors were encountered: