Re: Element.createElement proposal

Johnny Stenback <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization Mozilla Corporation
Message-ID <[email protected]>

On 08/10/2009 06:06 PM, Zack Weinberg wrote:
> 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'

What should that code do if you replace parent.addChild('svg') with 
parent.addChild('a')? And does this always append, or insert at the 
beginning, what if I want to insert somewhere in the middle etc etc?

>
> ?  The same would work for<math>.
>
> zw

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