W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: A proposal for Element constructors

From: John-David Dalton <john.david.dalton@gmail.com>
Date: Thu, 27 Oct 2011 02:47:17 -0400
Message-ID: <CAE5ikSa=N-AmGtzyNJP-Rb32UQ9YgGVjHmkBKPg4pxsE+j2jnA@mail.gmail.com>
To: Rick Waldron <waldron.rick@gmail.com>
Cc: Kentaro Hara <haraken@chromium.org>, public-webapps@w3.org, Dominic Cooney <dominicc@chromium.org>
Rick has a point.
I used Prototype's Element constructor for years and have moved
towards the jQuery approach in my own API.
Something like Element('<div>') is so so soo nice compared with more
verbose alternatives and you can still add attributes to elements via
a second argument. I know some prefer smth like Element('div#foo') ->
<div id="foo"></div> but that get's ugly when trying to expand that
syntax to an element's children. Also the `new` operator should be
optional as it is with others like `Array`, `RegExp`, and `Function`.
http://api.jquery.com/jQuery/#jQuery2

Also these mods should be safe for libs like Prototype because they
pave the Element class with their own custom Element constructor.

- John-David Dalton
Received on Friday, 28 October 2011 12:03:24 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:48 GMT