Correct, and it also allows you to attach multiple event handlers to a single element/event pair, as well as detach them at will. It's just a more robust model.

On 7/7/06, Tobie Langel <[EMAIL PROTECTED]> wrote:
Hi all,

I'm generating a new element through _javascript_ upon initializing a
class. This element needs to react to an onclick event.

Is there a difference in using this:

        element = document.createElement ("li");
        element.>        $('container').appendChild(element);

rather then this:

        element = document.createElement("li");
        $('container').appendChild(element);
        Event.observe(element, 'click',
this.handleClick.bindAsEventListener(this));

If so, what is it, and which solution should I favor.

(From what I understand skimming through the code,   Event.observe()
deals with IE leakage by using an onunload event, while the first
solution would not, is this correct?)

Thanks and best regards,

Tobie

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to