bumbu/svg-pan-zoom

Uncaught errors thrown by events targeting children of a <foreignObject> element

Open

#51 建立於 2014年7月16日

在 GitHub 查看
 (7 留言) (0 反應) (0 負責人)JavaScript (1,585 star) (383 fork)batch import
bughelp wanted

描述

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.

貢獻者指南

Uncaught errors thrown by events targeting children of a <foreignObject> element · bumbu/svg-pan-zoom#51 | Good First Issue