[Seaside] Using Insertions and Script Aculo

Lukas Renggli renggli at gmail.com
Mon Sep 24 11:44:00 UTC 2007

On 9/24/07, Lukas Renggli <renggli at gmail.com> wrote:
> > Thank you very much for your small "tutorial"..
> > But can you also help me to ensure, that DOM object exists. I need to check
> > for existense, before removing it or making insertiong
> As I said, it is much easier to do the whole logic in Smalltalk and
> just regenerate the whole part without the element ...
> Anyway, it is possible in JavaScript with something like that:
>    "if the element #foo is there, remove it "
>    (html selector new add: '#foo'; size)
>        then: (html element id: 'foo'; remove)
> This generates something like:
>    $$('#foo').size() ? $('foo').remove()

Actually, I think the following code is much simpler (and doesn't
require the latest version of script.aculo.us):

     html selector add: '#foo'; do: [ :ea | ea element remove ]

This code just iterates over the elements matching #foo and removes
them (if there is one available).


Lukas Renggli

More information about the seaside mailing list