Creating inline SVG with JS in HTML5

前端 未结 1 1828
失恋的感觉
失恋的感觉 2021-02-14 07:15

I\'m working with a local HTML5 file -- it\'s got at the top. I put something like this in it:



        
相关标签:
1条回答
  • 2021-02-14 07:50

    Turns out it was a namespace issue: the elements need to be created with createElementNS("http://www.w3.org/2000/svg", ...), which Prototype happens to have no built in (new Element(...)) support for. So I guess the HTML5 SVG situation is basically "SVG without a namespace gets the namespace added during parsing (but after that it's just like XHTML before)".

    P.S., the "Answer Your Question" button here isn't working for me today, so if anybody adds this as as answer, I'll mark it correct. :-)

    0 讨论(0)
提交回复
热议问题