- From: Boris Zbarsky <bzbarsky@mit.edu>
- Date: Tue, 11 Nov 2014 16:01:51 -0500
- To: www-dom@w3.org
On 11/11/14, 1:58 PM, Dirk Schulze wrote: > <html><svg><g></g></svg> > <script> > document.getElementsByTagName(g)[0].innerHTML = <a></a>; > </script> > </html> > > Does that even parse? Yes. > Reading the spec, it probably should be parsed with the HTML parser Yes, using https://html.spec.whatwg.org/#html-fragment-parsing-algorithm > Which namespace does <a> have here? The intent is for it to have the SVG namespace, but I can't figure out from the spec how that happens... > <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? The fragment parsing algorithm only looks at the context element it's passed, which in this case is the <html> element. So the <a> gets created in the HTML namespace. -Boris
Received on Tuesday, 11 November 2014 21:02:19 UTC