diff --git a/src/core/PaperScope.js b/src/core/PaperScope.js index d9f3efe8..c430647e 100644 --- a/src/core/PaperScope.js +++ b/src/core/PaperScope.js @@ -137,12 +137,15 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{ } }); }); - // Use scope as side-car (= 'this' inside iterator), and have it - // returned at the end. - return Base.each(this, function(value, key) { - if (!(key in this)) - this[key] = value; - }, scope); + // Copy over all fields from this scope to the destination. + // Do not use Base.each, since we also want to enumerate over + // fields on PaperScope.prototype, e.g. all classes + for (var key in this) { + if (!/^(version|_id|load)/.test(key) && !(key in scope)) { + console.log(key); + scope[key] = this[key]; + } + } }, /** diff --git a/src/paper.js b/src/paper.js index 051d025f..3e970546 100644 --- a/src/paper.js +++ b/src/paper.js @@ -127,6 +127,9 @@ var paper = new function() { // the first PaperScope and return it, all in one statement. // The version for 'dev' of this happens in core/initialize.js, since it depends // on sequentiality of include() loading. +// Mark this object as enumerable, so all the injected classes can be enumerated +// again in PaperScope#install(). +this.enumerable = true; return new (PaperScope.inject(this)); /*#*/ } // options.version != 'dev' };