bumbu/svg-pan-zoom

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

Open

#51 aberto em 16 de jul. de 2014

Ver no GitHub
 (7 comments) (0 reactions) (0 assignees)JavaScript (383 forks)batch import
bughelp wanted

Métricas do repositório

Stars
 (1.585 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

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.

Guia do colaborador