Re: A proposal for Element constructors

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 UTC