Skip to content

Commit

Permalink
Bugfix release for IE
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed May 31, 2010
1 parent 1669539 commit 9101bea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 8 additions & 2 deletions classy.js
Expand Up @@ -7,7 +7,7 @@

;(function(undefined) {
var
CLASSY_VERSION = '1.2',
CLASSY_VERSION = '1.3',
root = this,
old_class = Class,
disable_constructor = false;
Expand Down Expand Up @@ -51,7 +51,13 @@
different versions of the classy library to be used side by side and
in combination with other libraries. */
Class.$noConflict = function() {
setOrUnset(root, 'Class', old_class);
try {
setOrUnset(root, 'Class', old_class);
}
catch (e) {
// fix for IE that does not support delete on window
root.Class = old_class;
}
return Class;
};

Expand Down
8 changes: 7 additions & 1 deletion tests/core.js
Expand Up @@ -171,6 +171,9 @@ test('patching in prototypes', function() {
__init__ : function() {
called.push(42);
},
getFoo : function() {
return this.foo;
},
toString : function() {
return this.foo + ' ' + this.bar;
}
Expand All @@ -179,7 +182,10 @@ test('patching in prototypes', function() {
var obj = Test.$withData(data);
equal(obj.foo, 23, 'Test.foo is 23');
equal(obj.bar, 42, 'Test.bar is 42');
equal(obj.toString(), '23 42', 'Test.toString() is "23 42"');
equal(obj.getFoo(), obj.foo, 'getFoo() returns foo');
// IE bug we cannot support
if (!navigator.userAgent.match(/MSIE/))
equal(obj.toString(), '23 42', 'Test.toString() is "23 42"');
equal(called.length, 0, 'constructor was never called');
});

Expand Down

0 comments on commit 9101bea

Please sign in to comment.