In my test class, I call show() method externally and then internally
but the internal calls are not working when binding "this". The
expected console results for the following implementation:
_test = new test();
_test.show('outer', 0);
_test.hide('outer');
EXPECTED CONSOLE LOG:
show: outer
show: inner
show: inner no bind
hide: inner
hide: outer
ACTUAL CONSOLE LOG:
show: outer
show: inner no bind
hide: outer
Here is my test class. Is there something wrong with the binding
method?
var test = Class.create({
show: function(caller, itt)
{
console.log('show: ' + caller);
if(itt == 0)
{
this.show.bind(this, 'inner', 1);
this.show('inner no bind', 1);
}
if(itt == 1)
this.hide.bind(this, 'inner', itt);
},
hide: function(caller)
{
console.log('hide: ' + caller);
}
});
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.