Re: Element.create(): a proposal for more convenient element creation

2011-08-08 Thread Tab Atkins Jr.
On Sat, Aug 6, 2011 at 9:05 AM, Dominic Cooney domin...@google.com wrote: Third, is the order of attributes significant for XML namespace declarations? eg does this: x xmlns:foo=… foo:bar=… / mean the same thing as x foo:bar=… xmlns:foo=… / ? If not, including namespaces in the attribute

Re: Element.create(): a proposal for more convenient element creation

2011-08-08 Thread Jonas Sicking
On Mon, Aug 8, 2011 at 12:52 AM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Sat, Aug 6, 2011 at 9:05 AM, Dominic Cooney domin...@google.com wrote: Third, is the order of attributes significant for XML namespace declarations? eg does this: x xmlns:foo=… foo:bar=… / mean the same thing as x

Re: Element.create(): a proposal for more convenient element creation

2011-08-08 Thread Garrett Smith
On 8/6/11, Charles Pritchard ch...@jumis.com wrote: [...] I've stated in prior threads, that unless the word is aria-* or data-*, properties are set on the element. I see. But that's inherently inconsistent and mostly misleading (attr alludes to attribute not usually property except when it's

Re: Element.create(): a proposal for more convenient element creation

2011-08-08 Thread Julian Reschke
On 2011-08-08 10:17, Jonas Sicking wrote: On Mon, Aug 8, 2011 at 12:52 AM, Tab Atkins Jr.jackalm...@gmail.com wrote: On Sat, Aug 6, 2011 at 9:05 AM, Dominic Cooneydomin...@google.com wrote: Third, is the order of attributes significant for XML namespace declarations? eg does this: x

Re: Element.create(): a proposal for more convenient element creation

2011-08-08 Thread Jonas Sicking
On Mon, Aug 8, 2011 at 2:17 AM, Julian Reschke julian.resc...@gmx.de wrote: On 2011-08-08 10:17, Jonas Sicking wrote: On Mon, Aug 8, 2011 at 12:52 AM, Tab Atkins Jr.jackalm...@gmail.com  wrote: On Sat, Aug 6, 2011 at 9:05 AM, Dominic Cooneydomin...@google.com  wrote: Third, is the order

Re: Element.create(): a proposal for more convenient element creation

2011-08-08 Thread Julian Reschke
On 2011-08-08 11:34, Jonas Sicking wrote: ... First off, that's infinitely more work to support a rarely used feature than not supporting it at all. Second, since that notation isn't used anywhere else, it's a pretty big cost in brain print for users. So no, I wouldn't say it's cheap. ...

Re: Element.create(): a proposal for more convenient element creation

2011-08-08 Thread Tab Atkins Jr.
On Mon, Aug 8, 2011 at 1:17 AM, Jonas Sicking jo...@sicking.cc wrote: Is there a reason to support namespaced attributes at all? They are extremely rare, especially on the web. Ideally I'd like to deprecate them, but I suspect that's not doable. But I see no reason to support them in new

Re: Element.create(): a proposal for more convenient element creation

2011-08-08 Thread Jonas Sicking
On Mon, Aug 8, 2011 at 9:17 AM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Mon, Aug 8, 2011 at 1:17 AM, Jonas Sicking jo...@sicking.cc wrote: Is there a reason to support namespaced attributes at all? They are extremely rare, especially on the web. Ideally I'd like to deprecate them, but I

Re: Element.create(): a proposal for more convenient element creation

2011-08-06 Thread Dominic Cooney
Element.create looks neat. Three thoughts: First, I think Element.create *and* constructors like new HTMLDivElement(attributes, children) are both useful. Element.create is good when you have a tag name in hand, are creating unknown elements, or are creating elements that don’t have a specific

Re: Element.create(): a proposal for more convenient element creation

2011-08-06 Thread Charles Pritchard
On 8/6/2011 9:05 AM, Dominic Cooney wrote: Element.create looks neat. Three thoughts: ... Let me briefly reiterate that I think we want *both* Element.create and constructors; they have complementary uses. I agree. Second, re: setAttribute vs setting properties, there might be types other

Re: Element.create(): a proposal for more convenient element creation

2011-08-06 Thread Garrett Smith
On 8/6/11, Charles Pritchard ch...@jumis.com wrote: On 8/6/2011 9:05 AM, Dominic Cooney wrote: Element.create looks neat. Three thoughts: ... Let me briefly reiterate that I think we want *both* Element.create and constructors; they have complementary uses. I agree. And for no reason, it

Re: Element.create(): a proposal for more convenient element creation

2011-08-06 Thread Charles Pritchard
On 8/6/2011 3:54 PM, Garrett Smith wrote: On 8/6/11, Charles Pritchardch...@jumis.com wrote: On 8/6/2011 9:05 AM, Dominic Cooney wrote: Element.create looks neat. Three thoughts: ... Let me briefly reiterate that I think we want *both* Element.create and constructors; they have

Re: Element.create(): a proposal for more convenient element creation

2011-08-05 Thread Garrett Smith
On 8/4/11, Garrett Smith dhtmlkitc...@gmail.com wrote: [...] ser-generated function function. The scope of handler attributes is explained in HTML 5, though incompletely: http://dev.w3.org/html5/spec/Overview.html#event-handler-content-attributes That's incomplete. Correction: It is

Re: Element.create(): a proposal for more convenient element creation

2011-08-04 Thread Jonas Sicking
On Wed, Aug 3, 2011 at 8:10 AM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Wed, Aug 3, 2011 at 12:34 AM, Anne van Kesteren ann...@opera.com wrote: On Tue, 02 Aug 2011 20:31:04 +0200, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Aug 2, 2011 at 11:26 AM, Glenn Maynard gl...@zewt.org

Re: Element.create(): a proposal for more convenient element creation

2011-08-04 Thread Garrett Smith
On 8/4/11, Jonas Sicking jo...@sicking.cc wrote: On Wed, Aug 3, 2011 at 8:10 AM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Wed, Aug 3, 2011 at 12:34 AM, Anne van Kesteren ann...@opera.com wrote: On Tue, 02 Aug 2011 20:31:04 +0200, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Aug 2,

Re: Element.create(): a proposal for more convenient element creation

2011-08-03 Thread Anne van Kesteren
On Tue, 02 Aug 2011 20:31:04 +0200, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Aug 2, 2011 at 11:26 AM, Glenn Maynard gl...@zewt.org wrote: On Tue, Aug 2, 2011 at 2:18 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: MooTools is basically identical to Prototype, except that you can

Re: Element.create(): a proposal for more convenient element creation

2011-08-03 Thread Charles Pritchard
On 8/3/2011 8:51 AM, Anne van Kesteren wrote: On Wed, 03 Aug 2011 17:46:50 +0200, Glenn Maynard gl...@zewt.org wrote: What's the difference? ele.setAttribute(x, val) works on any element. ele[x] = val does not. They also behave differently for a large number of cases and the latter often

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Maciej Stachowiak
On Aug 1, 2011, at 8:36 PM, João Eiras wrote: On , Ian Hickson i...@hixie.ch wrote: On Mon, 1 Aug 2011, Ryosuke Niwa wrote: On Mon, Aug 1, 2011 at 6:33 PM, Maciej Stachowiak m...@apple.com wrote: In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Maciej Stachowiak
On Aug 1, 2011, at 8:43 PM, Tab Atkins Jr. wrote: On Mon, Aug 1, 2011 at 7:05 PM, Charles Pritchard ch...@jumis.com wrote: Can we have it 'inherit' a parent namespace, and have chaining properties? Element.create('div').create('svg').create('g').create('rect', {title: 'An svg rectangle in

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Charles Pritchard
On Aug 1, 2011, at 9:25 PM, Ian Hickson i...@hixie.ch wrote: On Tue, 2 Aug 2011, João Eiras wrote: While the idea is interesting, create is a too simple name to add on something as polluted as Element. Why? I think create() is fine. It's a pretty common name for a factory or

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Jonas Sicking
On Mon, Aug 1, 2011 at 6:33 PM, Maciej Stachowiak m...@apple.com wrote: In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea for convenient element creation: Element.create(tagName, attributeMap, children…)    Creates an element with the specified tag,

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Roland Steiner
On Tue, Aug 2, 2011 at 4:36 PM, Jonas Sicking jo...@sicking.cc wrote: This doesn't explain why a factory method is better than explicit constructors though? The above could be written as new HTMLParagraphElement(null, foo, ...); It's not a general use case, but at least when it comes to

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Dimitri Glazkov
On Tue, Aug 2, 2011 at 1:27 AM, Roland Steiner rolandstei...@google.com wrote: On Tue, Aug 2, 2011 at 4:36 PM, Jonas Sicking jo...@sicking.cc wrote: This doesn't explain why a factory method is better than explicit constructors though? The above could be written as new

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Aryeh Gregor
On Mon, Aug 1, 2011 at 9:33 PM, Maciej Stachowiak m...@apple.com wrote: In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea for convenient element creation: Element.create(tagName, attributeMap, children…)    Creates an element with the specified tag,

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Ian Hickson
On Tue, 2 Aug 2011, Dimitri Glazkov wrote: On Tue, Aug 2, 2011 at 1:27 AM, Roland Steiner rolandstei...@google.com wrote: On Tue, Aug 2, 2011 at 4:36 PM, Jonas Sicking jo...@sicking.cc wrote: This doesn't explain why a factory method is better than explicit constructors though? The

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Dimitri Glazkov
On Tue, Aug 2, 2011 at 10:37 AM, Ian Hickson i...@hixie.ch wrote: On Tue, 2 Aug 2011, Dimitri Glazkov wrote: On Tue, Aug 2, 2011 at 1:27 AM, Roland Steiner rolandstei...@google.com wrote: On Tue, Aug 2, 2011 at 4:36 PM, Jonas Sicking jo...@sicking.cc wrote: This doesn't explain why a

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Tab Atkins Jr.
On Tue, Aug 2, 2011 at 12:36 AM, Jonas Sicking jo...@sicking.cc wrote: I'm not sure if it's better to include the children as a var-args list, or as an array. Certainly when typing things normally var-args saves you the [ and ], but when coding, if you've built the child list dynamically and

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Charles Pritchard
On 8/2/2011 9:48 AM, Aryeh Gregor wrote: On Mon, Aug 1, 2011 at 9:33 PM, Maciej Stachowiakm...@apple.com wrote: In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea for convenient element creation: Element.create(tagName, attributeMap, children…) Creates

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Tab Atkins Jr.
On Tue, Aug 2, 2011 at 9:48 AM, Aryeh Gregor a...@aryeh.name wrote: On Mon, Aug 1, 2011 at 9:33 PM, Maciej Stachowiak m...@apple.com wrote: In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea for convenient element creation: Element.create(tagName,

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Aryeh Gregor
On Tue, Aug 2, 2011 at 2:05 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: Read again - the idea is to auto-expand arrays. (I don't have much of a preference between just use an array and use varargs, but expand arrays.  I agree that using only varargs without expansion would be bad.) I'm

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Glenn Maynard
On Tue, Aug 2, 2011 at 2:18 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: MooTools is basically identical to Prototype, except that you can additionally set listeners on the element during creation by using a magical events property in the attribute bag, which takes an object of event names

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Garrett Smith
On 8/2/11, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Aug 2, 2011 at 9:48 AM, Aryeh Gregor a...@aryeh.name wrote: On Mon, Aug 1, 2011 at 9:33 PM, Maciej Stachowiak m...@apple.com wrote: In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea for

Re: Element.create(): a proposal for more convenient element creation

2011-08-02 Thread Tab Atkins Jr.
On Tue, Aug 2, 2011 at 11:26 AM, Glenn Maynard gl...@zewt.org wrote: On Tue, Aug 2, 2011 at 2:18 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: MooTools is basically identical to Prototype, except that you can additionally set listeners on the element during creation by using a magical events

Element.create(): a proposal for more convenient element creation

2011-08-01 Thread Maciej Stachowiak
In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea for convenient element creation: Element.create(tagName, attributeMap, children…) Creates an element with the specified tag, attributes, and children. tagName - tag name as a string; by default it

Re: Element.create(): a proposal for more convenient element creation

2011-08-01 Thread Ian Hickson
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

Re: Element.create(): a proposal for more convenient element creation

2011-08-01 Thread Ryosuke Niwa
On Mon, Aug 1, 2011 at 6:33 PM, Maciej Stachowiak m...@apple.com wrote: In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea for convenient element creation: Element.create(tagName, attributeMap, children…) Can we alternatively extend

Re: Element.create(): a proposal for more convenient element creation

2011-08-01 Thread Charles Pritchard
On Aug 1, 2011, at 6:43 PM, Ian Hickson i...@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.

Re: Element.create(): a proposal for more convenient element creation

2011-08-01 Thread Ian Hickson
On Mon, 1 Aug 2011, Ryosuke Niwa wrote: On Mon, Aug 1, 2011 at 6:33 PM, Maciej Stachowiak m...@apple.com wrote: In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea for convenient element creation: Element.create(tagName, attributeMap, children�)

Re: Element.create(): a proposal for more convenient element creation

2011-08-01 Thread João Eiras
On , Ian Hickson i...@hixie.ch wrote: On Mon, 1 Aug 2011, Ryosuke Niwa wrote: On Mon, Aug 1, 2011 at 6:33 PM, Maciej Stachowiak m...@apple.com wrote: In an IRC discussion with Ian Hickson and Tab Atkins, we can up with the following idea for convenient element creation:

Re: Element.create(): a proposal for more convenient element creation

2011-08-01 Thread Cameron McCormack
On 2/08/11 3:36 PM, João Eiras wrote: However, Nodes need a ownerDocument, and that needs to be supplied, even if optionally. Doing document.createElement implies the document, Element.create does not. I figure the ownerDocument would be window.document (where the window object is the global

Re: Element.create(): a proposal for more convenient element creation

2011-08-01 Thread Tab Atkins Jr.
On Mon, Aug 1, 2011 at 7:05 PM, Charles Pritchard ch...@jumis.com wrote: Can we have it 'inherit' a parent namespace, and have chaining properties? Element.create('div').create('svg').create('g').create('rect', {title: 'An svg rectangle in an HTML div'}); Ooh, so .create is defined both on

Re: Element.create(): a proposal for more convenient element creation

2011-08-01 Thread João Eiras
On , Tab Atkins Jr. jackalm...@gmail.com wrote: On Mon, Aug 1, 2011 at 7:05 PM, Charles Pritchard ch...@jumis.com wrote: Can we have it 'inherit' a parent namespace, and have chaining properties? Element.create('div').create('svg').create('g').create('rect', {title: 'An svg rectangle in an

Re: Element.create(): a proposal for more convenient element creation

2011-08-01 Thread Ian Hickson
On Tue, 2 Aug 2011, João Eiras wrote: However, Nodes need a ownerDocument, and that needs to be supplied, even if optionally. Doing document.createElement implies the document, Element.create does not. Just use the same document as new Image(), new Option(), or new Audio(). -- Ian