Export to GitHub

digg - issue #8

Class.js defect in Chrome, Opera, and Safari


Posted on Dec 29, 2011 by Swift Rhino

In any of the above mentioned browsers, the inheritance doesn't seem to work using the this.sup() method as the caller's name is an empty string(the caller being anonymous function).

A possible solution:

instead of this code: try { var caller = this.sup.caller.name; this.supers[caller].apply(this, arguments); } catch(noSuper) { return false; }

this code may work in all of the browsers var caller = this.sup.caller.name; try { this.supers[caller].apply(this, arguments); } catch(noSuper) { if(caller === ''){ for (var i in this.supers) { if (i && this.supers[i] === this.sup.caller) { this.supers[i].apply(this, arguments); } } } return false; }

This method may give you a the same output despite of the browser.(sorry, didn't have tried this code).

Status: New

Labels:
Type-Defect Priority-Medium