W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2011

Re: Simplifying element creation

From: Ojan Vafai <ojan@chromium.org>
Date: Tue, 4 Oct 2011 18:07:59 -0700
Message-ID: <CANMdWTs8GSmFC9UKvxo_-16cfvBcSeSxhDHPHr2a4B3MWDUqgA@mail.gmail.com>
To: Roland Steiner <rolandsteiner@google.com>
Cc: Dominic Cooney <dominicc@chromium.org>, Anne van Kesteren <annevk@opera.com>, "www-dom@w3.org" <www-dom@w3.org>
On Tue, Oct 4, 2011 at 6:01 PM, Roland Steiner <rolandsteiner@google.com>wrote:

> On Wed, Oct 5, 2011 at 9:39 AM, Ojan Vafai <ojan@chromium.org> wrote:
>
>> Given ES6 spread, I don't think we need to allow NodeList or Array. Not
>> allowing arrays also means we avoid the issue that Roland brought up because
>> the first string in any array is an element name and not text and only the
>> first string in an array is an element name.
>>
>> For example:
>> foo.append('div'); // appends the string 'div' to foo as a text node
>> foo.append(['div']); // appends a div element to foo
>>
>
> That seems reasonable. Conversely, being strict about this means
>
> ['style', 'scoped']
>
> is not equivalent to <style scoped>, neither equivalent to
> <style>scoped</style>, but simply an error (that throws, I presume?).
>

What's the error? This would just be <style>scoped</style>. The attributes
and event objects are optional.


>
>
>
>> Element.create(['div', {}, {'onclick': 'return false;', 'onmousedown':
>> function() {}}]);
>>
>
> Probably this has been brought up before, but what prevents event handlers
> from being put together with regular attributes (which I'm sure people will
> try), by design or by error? E.g.,
>
> ['div', {'style': 'background-color: red'; color: white, 'onclick':
> 'doThaClick()'}]
>
> Conversely, why the requirement to have 2 different entries for those?
> Conceptually, when writing <div style="color:red" onclick="clicky()"> there
> isn't a distinction either.
>
>
> Cheers,
>
> - Roland
>
>
>
Received on Wednesday, 5 October 2011 01:08:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:08 GMT