Thanks Ryan for clearing up this issue.
regards,
Tobie
Date: Fri, 7 Jul 2006 15:26:25 -0500
From: "Ryan Gahl" <[EMAIL PROTECTED]>
Subject: Re: [Rails-spinoffs] Event.observe(element, 'click', fn); vs.
element.onclick = fn;
To: [email protected]
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"
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.onclick = this.handleClick.bindAsEventListener(this);
$('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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs