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 <[EMAIL PROTECTED]> 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@googlegroups.com
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