bumbu/svg-pan-zoom
View on GitHubUncaught errors thrown by events targeting children of a <foreignObject> element
Open
#51 opened on Jul 16, 2014
bughelp wanted
Description
I'm working on a project which requires text wrapping and the approach I'm taking here is to embed an XHTML document inside a <foreignObject> element, as below.
<g>
<polygon points="..."></polygon>
<foreignObject>
<body>
<p>Blah blah, lorem ipsum something</p>
</body>
</foreignObject>
</g>
Now this renders just fine, panning is functional etc. but errors are thrown by events targeting anything inside the <foreignObject> element as neither evt.target.ownerSVGElement or evt.target.correspondingElement.ownerSVGElement are defined for these elements.
I've hacked in a "fix" which walks up the document tree until they are defined, but I doubt (in my limited experience with SVG/XML) that's a valid approach for much outside of a narrow use case so there's no pull request here.