I use this a time ago for events, but I haven't time to test it.
Element.addMethods(
{
on: function (element, event, func)
{
var prop = ['event' + event];
if (!element[prop]) element[prop] = [];
element[prop].push(func);
I use this add-on to prototype(http://www.danwebb.net/2007/4/16/low-
pro-0-4-released) It have Event.onReady() function
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group,
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" gr
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 prototype-core@goo
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 thin
I really think that name and id should be different no to overload $()
with more functionality.
Besides it is easy to catch such error if there are names equal to ids
even in complicated JS scripts.
here http://video.yahoo.com/video/play?vid=410472 near 10 minute to
see more problems with IE and
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.
--~--~-~--~~~---~--~~
Yo
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 fun
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', this.onpress.bind(th
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 the
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 Event.regi
11 matches
Mail list logo