For anyone out there that has been using the Lebowski framework to test a SproutCore application, please be advised that Lebowski will currently not work with Internet Explorer versions 7 and 8. This is due to those versions of IE not following JavaScript standards and SproutCore not currently having a particular work around for IE. That being said, Lebowski framework does work with Firefox, Chrome and Safari.

For those interested in what is actually causing the problem and want a fix for it, read on…

The Lebowski framework does automatic type checking of any SproutCore object you are trying to proxy within a web browser. If Lebowski is unable to detect the type of the proxied object then it will always return an instance of a generic ProxyObject… which doesn’t really help you if you’re trying to test your app :-p.

In order for the type checking to work, Lebowski leverages SproutCore’s SC._object_className function which helps in the process of generating each class’s type that derives from some SproutCore class. Where things go wrong is in SproutCore’s findClassNames function located in the object.js file. The function works correctly in all browsers but IE 7 and 8. Why? Because of the way IE handles global variables.

Basically, the findClassNames is a recursive function that will iterate over a given object’s properties detecting if the property has a value that is of type SC.T_OBJECT or SC.T_CLASS, and in a special case, when the property’s name is “SC”. When a SproutCore class is detected, the function will then stick on a new property on the class called _object_className that has a string value representing the class’s type, such as “MyApp.FooView” or “SC.ButtonView”. Because this is an expensive operation, it’s only even done once.

When the findClassNames function is run in IE 7 and 8, things fail because global variables defined in IE are, annoyingly, not iterable on the window object. (I know, it’s really stupid. Boo IE.) So, for instance, if you do the following in IE:

MyApp = SC.Object.create({ ... });

You can access it normally by calling MyApp or window.MyApp, but if you try to do the following:

for (key in window) { ... }

which findClassNames does, the property with key "MyApp" will not be one of the keys you can access. Therefore global variables such as SC won't get detected.

I've made a fix for this issue and everything works, but that fix has not yet been included as part the official SproutCore framework. However, if you're ichin' to get the fix so you can move ahead with testing your SproutCore app against IE 7 and 8, check out the following: