How does createElementNS work?

I really don't understand how createElementNS works. For instance:

svg = "http://www.w3.org/2000/svg"; group = document.createElementNS(svg,"g"); 

Is this related to the specified namespace and gets 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 any other way to create the g element? One that does not require an online connection?

I don’t think so, because I do not see any requests, but still ... a little ambiguous.

The reason I'm asking is that something is slowing down my script a lot, and I don’t know exactly what.

+4
source share
1 answer

Is this related to the specified namespace and gets definitions for the g element?

Not. You cannot "connect" to the namespace. http://www.w3.org/2000/svg is a unique namespace identifier, but namespaces are not URLs. Software transmitting the DOM must understand SVG (and will have an internal namespace to understand it).

The URL http://www.w3.org/2000/svg is a document that tells readers where to find additional information about SVG, but this is just what is useful to the authors, there is no programmatic meaning of the document there.

+8
source

Source: https://habr.com/ru/post/1398212/


All Articles