Re: DOM-Parsing innerHTML/outerHTML and namespaces

Dirk Schulze <[email protected]>
Newsgroups gmane.comp.web.dom.general
Message-ID <[email protected]>
On Nov 11, 2014, at 10:58 AM, Dirk Schulze <[email protected]> wrote:

> Hi,
> 
> I have some question to clarification the use of element.innerHTML on SVG embedded in HTML. Maybe it is the easiest to use some examples:
> 
> <html><svg><g></g></svg>
> <script>
> document.getElementsByTagName(’g’)[0].innerHTML = “<a></a>”;
> </script>
> </html>

This example should read document.getElementsByTagName(’g’)[0].innerHTML = “<a>”;

> 
> Does that even parse? Reading the spec, it probably should be parsed with the HTML parser and therefore it doesn’t matter if the <a> tag is closed or not.
> 
> Which namespace does <a> have here? SVG namespace? HTML namespace? The topic namespaces is not really sufficiently specified IMO. SVG NS is not even called out, just XML namespace but not in the context of element creation. Obviously there are more namespaces to consider than just SVG though.
> 
> Depending on the question above:
> 
> <html><svg></svg>
> <script>
> document.getElementsByTagName(’svg’)[0].outerHTML = “<a></a>”;
> </script>
> </html>
> 
> Now we create <a> with the SVGSVGElement which has the SVG namespace, what namespace does <a> have?
> 
> Greetings,
> Dirk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.