This is a great feature to have in Prototype, but i have a few
suggestions to the syntax. I have been using a DOM creation function
of my own and I find the following features very useful:

1) the "new" notation gets a bit long winded. I have a factory typed
method called $E()
2) create sub methods to the $E object with the element names. eg
$E.div(), $E.span() etc
3) allow extra parameters for creating child nodes of different types
(the method detects the types of the parameters and treats them
correctly):

// String
$E.a({href:'www.google.com'}, 'Google');
// creates <a href="www.google.com">Google</a>

// Element
$E.a({href:'www.google.com'}, $E.strong('Google'));
// creates <a href="www.google.com"><strong>Google<strong></a>

// Array of Elements
$E.div({className:'links'},$E.h2('Your Links'), $$('a[href]'));
// creates a new div with the title "Your Links" and moves all links
in the page into it.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to