admin管理员组文章数量:1356871
I don't really understand how does createElementNS works. For example:
svg = "";
group = document.createElementNS(svg,"g");
Does this connect to the specified namespace and gets the definitions for the g element?
If so... if placed inside a for there will be some kind of request to the specified url?
Is there another way to create a g element? One that does not require online connection?
I don't think so because I don't see any requests going there but still... is a bit ambiguous.
The reason why I'm asking is that something is greatly slowing my script down and I don't know exactly what.
I don't really understand how does createElementNS works. For example:
svg = "http://www.w3/2000/svg";
group = document.createElementNS(svg,"g");
Does this connect to the specified namespace and gets the definitions for the g element?
If so... if placed inside a for there will be some kind of request to the specified url?
Is there another way to create a g element? One that does not require online connection?
I don't think so because I don't see any requests going there but still... is a bit ambiguous.
The reason why I'm asking is that something is greatly slowing my script down and I don't know exactly what.
Share Improve this question edited Jan 8, 2018 at 11:15 ekad 14.6k26 gold badges46 silver badges48 bronze badges asked Feb 24, 2012 at 10:51 zozozozo 8,59219 gold badges83 silver badges141 bronze badges 1- I don't think an html page retrieves any data from the namespace address. When defining a namespace in other languages (C++, Java), it is essentially a string label. I think that people use the address because it refers to the exact specification of the namespace they are using. For instance, if you had a namespace called "svg", that gives someone looking at the code no additional info. If you input the address into your web browser, you get every detail of the namespace capabilities. Afaik, it's just a great way to organize namespaces. It also separates different versions of the standard. – NuclearPeon Commented Feb 1, 2013 at 20:18
1 Answer
Reset to default 11Does this connect to the specified namespace and gets the definitions for the g element?
No. You can't "connect" to a namespace. http://www.w3/2000/svg
is a unique identifier for the namespace, but namespaces are not URLs. The software handing the DOM needs to understand SVG (and will have the namespace mapped internally to its understanding of it).
The URL http://www.w3/2000/svg
is a document that tells readers where to find more information about SVG, but that is just the authors being helpful, there is no programatic significance of a document existing there.
本文标签: javascriptHow does createElementNS workStack Overflow
版权声明:本文标题:javascript - How does createElementNS work? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743969442a2570491.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论