Why there are Builder.node from scriptaculous if threre are exists new Element? Which one should I use to create a DOM elements and then append it to some other element? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Builder.node() boils down to DOM operations, but it''s a handy DSL for doing nested element creation without creating all the intermediate objects and gluing them together: document.observe(''dom:loaded'', function() { $(''stuff'').update( Builder.node(''table'', {id: ''mytable''}, [ Builder.node(''tr'', [ Builder.node(''td'', ''cell 1''), Builder.node(''td'', ''cell 2''), Builder.node(''td'', ''cell 3'') ]) ]) ); }); Or if you do Builder.dump() first: Builder.dump(); document.observe(''dom:loaded'', function() { $(''stuff'').update( TABLE({id: ''mytable''}, [ TR([ TD(''cell 1''), TD(''cell 2''), TD(''cell 3'') ]) ]) ); }); You''re free to use whatever method you like best. :-) -Fred On Fri, Jun 13, 2008 at 7:57 AM, AlannY <m@alanny.ru> wrote:> > Why there are Builder.node from scriptaculous if threre are exists new > Element? > > Which one should I use to create a DOM elements and then append it to > some other element?-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
tnx --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
2008/6/13 AlannY <m@alanny.ru>:> > tnx > > >Don''t forget the template class. If you are building the same HTML structure again and again, then a template works really well. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Yes, and will be faster in many cases, due to the fact that it generates HTML markup, and takes advantage of the blazing fast performance of setting .innerHTML. -Fred On Fri, Jun 13, 2008 at 9:27 AM, Richard Quadling <rquadling-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Don''t forget the template class. If you are building the same HTML > structure again and again, then a template works really well. >-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---