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

Re: Simplifying element creation

From: Erik Arvidsson <arv@chromium.org>
Date: Tue, 4 Oct 2011 16:48:21 -0700
Message-ID: <CAJ8+Gogtg0-YYtp5B1=pj1hOtJPSri6mVYOcuJiz9uOC5D_gPQ@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>
Others have pointed this out put I find it very confusing that a
string is not treated as Text node in all cases.

I don't believe append should be responsible for creating new Elements.

erik








On Tue, Oct 4, 2011 at 16:28, Roland Steiner <rolandsteiner@google.com> wrote:
> On Tue, Oct 4, 2011 at 6:18 PM, Dominic Cooney <dominicc@chromium.org>
> wrote:
>>
>> On Tue, Oct 4, 2011 at 5:30 PM, Anne van Kesteren <annevk@opera.com>
>> wrote:
>> > E.g. <div>Hello <a href="/">World</a></div> is represented as:
>> >
>> >  ["div", "Hello ", ["a", {href:"/"}, "World"]]
>>
>> I think readability suffers a bit because element names and text are
>> both strings.
>
> It also invites errors, e.g., ["style", "scoped"] (missing curly brackets)
> But I think it's worse than just readability:
> .) you cannot have text nodes that contain a string that could be an element
> name, e.g., ["dl", ["dt", "object"], ["dd', "the base class of the type
> hierarchy"]].
> .) later on you cannot introduce new HTML elements, because someone might
> have used that element's name as a text string with the above syntax.
>
> Cheers,
> - Roland
>
Received on Tuesday, 4 October 2011 23:49:13 GMT

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