1 (function() {
  2   
  3   var IS_DONTENUM_BUGGY = (function(){
  4     for (var p in { toString: 1 }) {
  5       if (p === 'toString') return false;
  6     }
  7     return true;
  8   })();
  9   
 10   var addMethods;
 11   if (IS_DONTENUM_BUGGY) {
 12     /** @ignore */
 13     addMethods = function(klass, source) {
 14       if (source.toString !== Object.prototype.toString) {
 15         klass.prototype.toString = source.toString;
 16       }
 17       if (source.valueOf !== Object.prototype.valueOf) {
 18         klass.prototype.valueOf = source.valueOf;
 19       }
 20       for (var property in source) {
 21         klass.prototype[property] = source[property];
 22       }
 23     };
 24   }
 25   else {
 26     /** @ignore */
 27     addMethods = function(klass, source) {
 28       for (var property in source) {
 29         klass.prototype[property] = source[property];
 30       }
 31     };
 32   }
 33 
 34   function subclass() { };
 35   
 36   /**
 37    * Helper for creation of "classes"
 38    * @method createClass
 39    * @memberOf fabric.util
 40    */
 41   function createClass() {
 42     var parent = null, 
 43         properties = slice.call(arguments, 0);
 44     
 45     if (typeof properties[0] === 'function') {
 46       parent = properties.shift();
 47     }
 48     function klass() {
 49       this.initialize.apply(this, arguments);
 50     }
 51     
 52     klass.superclass = parent;
 53     klass.subclasses = [ ];
 54 
 55     if (parent) {
 56       subclass.prototype = parent.prototype;
 57       klass.prototype = new subclass;
 58       parent.subclasses.push(klass);
 59     }
 60     for (var i = 0, length = properties.length; i < length; i++) {
 61       addMethods(klass, properties[i]);
 62     }
 63     if (!klass.prototype.initialize) {
 64       klass.prototype.initialize = emptyFunction;
 65     }
 66     klass.prototype.constructor = klass;
 67     return klass;
 68   }
 69   
 70   fabric.util.createClass = createClass;
 71 })();