#16310 closed defect (fixed)
dijit/place can't anchor to SVG elements in Firefox
Reported by: | parente | Owned by: | bill |
---|---|---|---|
Priority: | undecided | Milestone: | 1.8.7 |
Component: | Dijit | Version: | 1.8.1 |
Keywords: | Cc: | James Thomas | |
Blocked By: | Blocking: |
Description
Bug is in place.js:
var aroundNodePos = (typeof anchor == "string" || "offsetWidth" in anchor) ? domGeometry.position(anchor, true) : anchor;
The anchor element in this case is an SVG descendent element (e.g., svg:circle). In Firefox, SVG elements do not have property offsetWidth. A simple fix that appears to work in FF 15+ is:
var aroundNodePos = (typeof anchor == "string" || "offsetWidth" in anchor || "ownerSVGElement" in anchor) ? domGeometry.position(anchor, true) : anchor;
The addition of the ownerSVGElement check is enough to get the geometry computed for the anchor SVG element instead of using the element itself (which causes lots of NaNs? downstream). Surprisingly, the lack of offsetWidth doesn't seem to impact the actual tooltip placement in all the tests I ran, but YMMV.
Attachments (1)
Change History (12)
comment:1 Changed 10 years ago by
Cc: | James Thomas added |
---|
comment:2 Changed 10 years ago by
Owner: | changed from bill to parente |
---|---|
Status: | new → pending |
Summary: | dijit Tooltip broken anchored to SVG elements in Firefox → dijit/place can't anchor to SVG elements in Firefox |
comment:3 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
comment:4 Changed 10 years ago by
I was hoping for a response on this, or at least a test case. If you are still interested in the ticket getting fixed, give a response with at least one of those.
comment:5 Changed 9 years ago by
I am having the same problem in a mapping application I am working on using the ESRI Javascript API. Attaching a tooltip to a 'path' element works on Chrome, but not on Firefox. Has any fix / workaround been provided for this issue?
Thanks for your help, Aaron
comment:6 Changed 9 years ago by
If you have a test case feel free to attach it and then write a comment, and we'll reopen the ticket.
comment:7 Changed 9 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Note the test case above has commented out workaround code.
comment:8 Changed 8 years ago by
Milestone: | tbd → 1.8.7 |
---|---|
Owner: | changed from parente to bill |
Status: | reopened → assigned |
comment:9 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Hmm, that expression is getting complicated. I think we could do the reverse check with something like
"x" in anchor
, or if not that, then some expression that will catch any element (SVG or HTML), like(typeof anchor == "string" || "nodeName" in anchor)
. Do either of those work?