I am trying to bind a function to it's class, so in the below example
I am expecting a result of "X Class" when I call method test(),
instead I'm receiving "undefined".  I am trying this with and without
the bind method for the function.  What am I doing wrong?

Karl..

var x = Class.create({
name: 'Class X',
test: function()
{
var func = { test: function() { return this.name; } }
func.test.bind(this);
return func.test();
},

});

var y = new x();
y.test();


--~--~---------~--~----~------------~-------~--~----~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to