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

Re: Simplifying element creation

From: João Eiras <joao.eiras@gmail.com>
Date: Tue, 4 Oct 2011 17:26:31 +0200
Message-ID: <CAJ+sA06Z3KRmaVW2zNosrvk9GzCrDZc6=vsu5bymYmvMoadL3Q@mail.gmail.com>
To: www-dom@w3.org
>>> E.g.<div>Hello<a href="/">World</a></div>  is represented as:
>>>
>>>  ["div", "Hello ", ["a", {href:"/"}, "World"]]

I consider using html fragments instead of json-like representations
for bulk element creation more optimal. It's non-ambiguous and doesn't
require many intermediate temporary objects, which just add
unnecessary overhead, because they would have to be created,
traversed, sanatized (handling getters and setters, or properties with
unexpected types), while the html parser does one pass (in an ideal
situation) and creates everything in one go.
Received on Tuesday, 4 October 2011 15:27:39 GMT

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