I'm running into a strange "bug?" when I try to override a insert.onChange method, and call the original from within the override. Here's my callstack, where I'm getting an error because event is undefined:
Now here is one frame deeper in the stack, and as you can see, the _onChange method is pointing to the function we've just defined, even though I've referenced the original function (insert.onChange) outside the scope of the new function:
To me what's really strange is that the second time through the loop, at the top of the callstack, the _onChange now references the correct original (anonymous) function.
I've tried wrapping it in more closures and have read over the other answers on SO about overriding and calling the original method in JS. Any help understanding what I'm doing wrong would be great.
Thanks! Thomas