John Resig (of jQuery fame) provides a concise implementation of Simple JavaScript Inheritance. His approach inspired my attempt to improve things even further. I've rewritten Resig's original Class.extend function to include the following advantages:
Performance – less overhead during class definition, object construction, and base class method calls
Flexibility – optimized for newer ECMAScript 5-compatible browsers (e.g. Chrome), but provides equivalent "shim" for older browsers (e.g. IE6)
Compatibility – validates in strict mode and provides better tool compatibility (e.g. VSDoc/JSDoc comments, Visual Studio IntelliSense, etc.)
Simplicity – you don't have to be a "ninja" to understand the source code (and it's even simpler if you lose the ECMAScript 5 features)
Robustness – passes more "corner case" unit tests (e.g. overriding toString in IE)
Because it almost seems too good to be true, I want to ensure my logic doesn't have any fundamental flaws or bugs, and see if anyone can suggest improvements or refute the code. With that, I present the classify function:
function classify(base, properties)
{
/// <summary>Creates a type (i.e. class) that supports prototype-chaining (i.e. inheritance).</summary>
/// <param name="base" type="Function" optional="true">The base class to extend.</param>
/// <param name="properties" type="Object" optional="true">The properties of the class, including its constructor and members.</param>
/// <returns type="Function">The class.</returns>
// quick-and-dirty method overloading
properties = (typeof(base) === "object") ? base : properties || {};
base =