Re: Element.createElement proposal

Zack Weinberg <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Message-ID <[email protected]>
Johnny Stenback <[email protected]> wrote:
> What I don't like about svgElement.createElement() is that it seems a 
> bit odd to have to find an element to create one, which makes the
> case where you're inserting SVG into a document where there is no
> existing SVG such that developers still need to type out that
> namespace URI they don't want to type out. svgElement.createChild()
> doesn't make any sense to me as there's no child relationship between
> the element you use for creating and the element that gets created.

What's wrong with

  var parent = document.getElementById("putsvghere"); // HTML elt
  var svg = parent.addChild('svg'); // HTML5 'svg' elt = SVG root elt
  var circle = svg.addChild('circle', {...}); // SVG 'circle'

?  The same would work for <math>.

zw
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.