Re: Simplifying element creation

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 UTC