#11515 closed bug (patchwelcome)
.width() and .height() returns 0 for SVG text element in FF and IE
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | dimensions | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The jQuery functions width() and height() returns 0 for SVG text elements in Firefox 11 and IE 9. In both Chrome 17 and 19 they work as expected.
element.getBoundingClientRect() returns the expected values in all of the browsers tested.
Here is a simple test page: http://jsfiddle.net/ckGcJ/31/
Change History (3)
comment:1 Changed 11 years ago by
Component: | unfiled → dimensions |
---|---|
Priority: | undecided → low |
Resolution: | → patchwelcome |
Status: | new → closed |
comment:2 Changed 11 years ago by
This could be related to a bug in Firefox 11 and 12 (https://bugzilla.mozilla.org/show_bug.cgi?id=740811). See also https://github.com/mootools/mootools-core/issues/2331.
comment:3 Changed 9 years ago by
The continuation of this issue on Mozilla's side can be found at https://bugzilla.mozilla.org/show_bug.cgi?id=874811
Note: See
TracTickets for help on using
tickets.
This is because Firefox and presumably IE 9 doesn't expose offsetWidth/offsetHeight on SVGTextElement, which the dimensions methods uses.
The problem with using getBoundingClientRect() is that Chrome and Firefox returns different numbers. I have no idea which one is correct. Do you?
This means there is no reliable way of getting the dimensions, that I know of.
I suggest you file a issue on the Firefox and IE bug trackers about the offsetWidth.
Closing this as patchwelcome (ref http://docs.jquery.com/Won%27t_Fix), though I don't see any way to fix this at the moment. Firefox is on quick release cycle, so that *could* be fixed pretty fast, IE9 however...