- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 2 Dec 2013 16:04:00 -0800
- To: Marat Tanalin <mtanalin@yandex.ru>
- Cc: Elliott Sprehn <esprehn@gmail.com>, "www-dom@w3.org" <www-dom@w3.org>
On Mon, Dec 2, 2013 at 3:59 PM, Marat Tanalin <mtanalin@yandex.ru> wrote:
> It would probably be more usable to have simple `Element` constructor with same arguments as `document.createElement()` method (including optional second argument containing attributes' map as I've proposed):
>
> var input = new Element('input', {
> 'type' : 'email',
> 'name' : 'foo',
> 'size' : 50,
> 'placeholder' : 'e.g. example@example.com',
> 'required' : ''
> });
I find "new Element('h1',...)" less good to read than something like
"HTML.h1(...)". (If you have a tagname in a string, you can always do
HTML[tag](...).)
> It would also be consistent with already existing web-developer-friendly constructors like `new Text` and `new Comment` (implemented in Firefox 24+, Chrome 28+, and Opera 15+).
Not really. There's a single type of Text node and Comment node.
There are many significant types of Element nodes. This isn't a good
way to slice up the functionality.
~TJ
Received on Tuesday, 3 December 2013 00:04:47 UTC