On Oct 24, 10:08 pm, simon <[EMAIL PROTECTED]> wrote:
> > hi all
>
> > i googled and read the docs but couldn't find anything. maybe i'm
> > blind but hopefully someone will enlighten me.
> > the functions insert and update take just a string as argument of what
> > to insert. but i would like to insert an element.
> > is there a way to get a string of the element containing the whole
> > subtree of nodes?
>
> > for example:
> > Element.update(element, anotherelement);
> > the the element will show something like [Object HTMLelement].
>
> > is it possible at all to get the subtree of an element as string or is
> > element just a pointer to a certain node?
>
> never mind. i found it out. innerHTML is my friend.
If you are moving an existing element and all its children, all you
need to do is attach it to its new location in the DOM using
appendChild.
Using innerHTML to get the string, then parse it back into the DOM
using innerHTML again is just plain silly. There is no standard for
innerHTML and it is implemented differently in different browsers, you
will likely encounter quirks if you persist with that strategy.
--
Rob
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---