I'm using event delegation a lot recently. I even opened a ticket for
it -
http://prototype.lighthouseapp.com/projects/8886/tickets/435-eventdelegate-and-elementmethodsdelegate
The problem I see in your approach, is that Event.stopObserving won't
clear callback from cache, but if your
I didn't understand why don't use Array.prototype.slice from here
http://www.danwebb.net/2006/11/7/a-low-down-dirty-goblin-of-a-hack ?
It was working well when I tested with my app ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
For a widget of mine I needed to a group of li elements to assign a
multiple events (note this is just part of the code so 'this'
reference to the widget:
revision 1:
var li = $$('#main li.views');
li.each(function(el)
{
el.observe('mousedown',
function Cat(){
this.color = yellow;
}
Cat.prototype.showColor = function(){
alert(this.color)
}
Cat.prototype.init(){
Event.observe(button, click, this.showColor.bind(this));
}
Will work just fine :) the problem is that when you assign action to a
button the scope of the function
Vote for #1
I think we as developers should think about the performance and code,
and we should be aware of this traps . But to make fix which will
be helpful for unaware people and lower the quality, I don't think It
is a good idea.
--~--~-~--~~~---~--~~
You
My be such wrapper around new Element() will be useful, but Ask your
self when you insert nodes where do you insert them, or how (with
appendChild, insertBefore, insertAfter, ), an when inserting item
do you just create it, or add events or do other things except that ?
mainly I do some thing
this sounds like:
$('some_element_id').appendChild( new Element(tagName, options) );
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Prototype: Core group.
To post to this group, send email to
I use this for events assignment (with little extension of mine):
http://alternateidea.com/blog/articles/2006/3/21/introducing-css-event-selectors
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Prototype: Core