Displaying 3 results from an estimated 3 matches for "registercallbackss".
Did you mean:
registercallbacks
2006 Mar 09
2
extending an existing DOM object in a prototype way
...th some functionality (like
onclick events, attributes, etc)
here''s what I have in mind, but I''m not sure this is exactly correct:
var ActiveSpan = Class.create();
ActiveSpan.prototype = {
initalize: function(span) {
Object.extend(span, this);
this.registerCallbacks();
},
registerCallbackss: function() {
Event.observe(this, ''click'', clickHandler.bindAsEventListener(this);
},
clickHandler: function(e) {
this.style.background = "red";
}
}
does this look right? Also, I''ll eventually want to go through the
child elements in the initalize metho...
2006 Mar 09
0
RE: extending an existing DOM object in a prototypeway
.../making this an instance method ensures you are wiring
up events to a DOM element (i.e. the element has already been extended
with this class -- "this" will now be the DOM element extended with the
ActiveSpan methods, and not just an "ActiveSpan")
this.registerCallbacks();
}
registerCallbackss: function() {
//ALWAYS store DOM handlers in variables so you can
dispose of them (prevent memory leaks)
this.clickHandlerPointer =
this.clickHandler.bindAsEventListener(this);
Event.observe(this, ''click'', this.clickHandlerPointer);
},
clickHandler: function(e) {
this.st...
2006 Mar 09
0
RE: extending an existing DOM object in aprototypeway
.../making this an instance method ensures you are wiring
up events to a DOM element (i.e. the element has already been extended
with this class -- "this" will now be the DOM element extended with the
ActiveSpan methods, and not just an "ActiveSpan")
this.registerCallbacks();
}
registerCallbackss: function() {
//ALWAYS store DOM handlers in variables so you can
dispose of them (prevent memory leaks)
this.clickHandlerPointer =
this.clickHandler.bindAsEventListener(this);
Event.observe(this, ''click'', this.clickHandlerPointer);
},
clickHandler: function(e) {
this.st...