Re: createElement in SVG context

Cyril Concolato wrote:
> Until recently, I has the understanding that document.createElement when
> called in the context of an SVG document would return a SVGElement when
> asking for the creation of SVG elements: e.g. "text", "g", .... Recent
> tests with Firefox Nightly and Chrome Canary proved me wrong: they both
> return Element objects. Why is that? I could not find any place in the
> spec that describes this behavior. Is there some text? Is it really the
> case that to create SVGElement you have to use createElementNS? That's a
> bit painful I think.

Painful, but I doubt it's something that can be changed.

   http://dom.spec.whatwg.org/#dom-document-createelement

Under http://people.mozilla.org/~cmccormack/improving-svg-dom 
createElement would still put the element in HTML namespace, but they 
would then still implement SVGElement and have all their usual SVG 
element behaviour.

Received on Thursday, 17 October 2013 02:54:16 UTC