Is it possible to navigate SVG object's elements from enclosing HTML?

后端 未结 4 2032
失恋的感觉
失恋的感觉 2020-12-31 23:41

I\'m loading an SVG through an object tag and need to access SVG\'s elements (to manipulate them). How can I do that?

Here\'re partial solutions I\'m aware of:

4条回答
  •  天命终不由人
    2021-01-01 00:32

    Could you use SVGweb? Here's an example of using an 'object' tag. I'm by no means an SVGweb guy, but I'm looking at the example in Chrome inspector and I can see nodes just fine. (Plus you'd have IE support built in.)

    It is another dependency, though (and they also rely on conditional comments for IE, not sure if that is acceptable in your situation).

    Alternatively, you could cheat off their source code and see how they do it. (Holy crap, they put tomes of documentation in there!)

提交回复
热议问题