- From: Dimitri Glazkov <dglazkov@google.com>
- Date: Mon, 1 Aug 2011 20:29:49 -0700
- To: Ian Hickson <ian@hixie.ch>
- Cc: Maciej Stachowiak <mjs@apple.com>, WebApps WG <public-webapps@w3.org>
On Mon, Aug 1, 2011 at 6:43 PM, Ian Hickson <ian@hixie.ch> wrote: > On Mon, 1 Aug 2011, Maciej Stachowiak wrote: >> >> Creates an element with the specified tag, attributes, and children. >> >> tagName - tag name as a string; by default it does "smart" selection >> of SVG, HTML or MathML namespace. Authors can also use an html: svg: or >> mathml: prefix to override these defaults. > > I'd suggest just always defaulting to HTML and requiring "svg:" and > "mathml:" prefixes for those namespaces. That makes code easier to read > (it's obvious what's going on, and you won't accidentally use elements > from the wrong namespace). It also makes forward-compatibility easier (we > don't have to worry about adding new elements to the list and what that > will do to future legacy UAs). > > >> (And further, you can use xmlns in attribute map to use a custom >> namespace.) > > I wouldn't bother supporting the "xmlns" attribute in this API, but I > don't feel strongly about this. > > >> attributeMap - JS object-as-dictonary or whatever dictionary type is >> appropriate to the language, or null for no attributes > > Optional attribute, too. > > >> children� - veridic parameter, can include nodes, strings, or arrays. >> Strings are converted to text nodes. Arrays are unpacked and treated as >> lists of nodes/strings. Array support is for cases where you want to >> have a call-site that may take a veriable-length list, with possible >> prefix and suffix. > > Also optional. > > > So you could also do: > > var div = Element.create('div'); This is all pretty cool. :DG<
Received on Tuesday, 2 August 2011 03:30:14 UTC