Actually, I think this is a more serious bug than I first thought. I'm getting this error in a few other places in my app now when FuncUnit testing in IE9 - not all related to jsTree.
I think that in synthetic.js, where the preventDefault function is defined (around line 456), I suspect that that may be the cause of this bug:
- var preventDefault = event.preventDefault,
- prevents = autoPrevent ? -1 : 0;
- //automatically prevents the default behavior for this event
- //this is to protect agianst nasty browser freezing bug in safari
- if ( autoPrevent ) {
- bind(element, type, function( ev ) {
- ev.preventDefault();
- unbind(this, type, arguments.callee);
- });
- }
- event.preventDefault = function() {
- prevents++;
- if (++prevents > 0 ) {
- preventDefault.apply(this, []);
- }
- };
In IE9, the global event object does not have a preventDefault property. I set a break point on line 1 above, and I could see that there was no preventDefault property on this event object too.
What is then happening is the undefined preventDefault property is being saved as a reference and then executed as if it was a function on line 14.
I'm pretty sure that is the source of the "Invalid calling object" error I'm experiencing since you can't call "apply" on a non-function.
So I don't quite get what is wrong with the event object that is being passed in then - I assume that it is supposed to have a preventDefault property like jQuery.Event does.
Cheers,
-adam
EDIT: uh, my debugging skills in IE9 are not the best. What I wrote above is wrong - but I still think this code snippet is the cause of the problem - because it is the only place in JavascriptMVC where I can see a preventDefault property being defined.
I'll keep trying to work it out, but if anyone has an idea please let me know. -adam