Thanks for the clarification.

Most methods that change content destroy the old content in favor of
the new. The same is true for #replace suggested above.

If you need to retain content while putting new content in its place,
you may need a deep-clone method (which i've requested in the past and
someone provided a possibility as an extension, but i couldn't get it
to work). A search on this group for "deep clone" brings up a thread
with a similar method and suggestions of additional arguments to
control the amount of storage that gets copied.

Another alternative could be to move the containers you need to
preserve to some other, hidden, parent container before placing the
new content.

Sorry i wasn't more helpful. i'm a little rusty of late, being pressed
for more C# development than web work lately. i hope one of the big-
brains here can take a look and offer something for you.
-joe t.


On Jul 3, 6:00 am, Viktor Kojouharov <vkojouha...@gmail.com> wrote:
> I understand that. And I was using update to clear the container and
> add a new element. My problem was, I have a reference to the previous
> element of the container that was just cleared, and I am saving that
> reference of the element with the intention of replacing the new
> container content with that element at some future time. Right now I'm
> using innerHTML = '', since using Element#update would wipe out the
> storage of the element I have a reference to, and that is highly
> undesirable.
>
> On Jul 2, 3:16 pm, "joe t." <thooke...@gmail.com> wrote:
>
> > Most people interpret it to mean "update with new content". Think
> > along the lines of a page refresh for just that element: wipe out the
> > existing content, update with new. Some others like yourself expect it
> > to mean "append with new content". That approach is handled by
> > Element#insert: preserve existing content, place new content at the
> > desired Position (usually appended, but insertion options are
> > available).
>
> >http://api.prototypejs.org/dom/element/insert/
>
> > This same question came up some months ago. Hopefully that
> > clarification helps.
> > -joe t.
>
> > On Jul 2, 5:24 am, Viktor Kojouharov <vkojouha...@gmail.com> wrote:
>
> > > This behaviour is a bit unexpected, and caused some debugging time to
> > > figure out why some elements were losing their storage. Why isn't this
> > > only done during page unload?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en

Reply via email to