mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-19 01:14:44 -05:00
Do lazy behavior copying only when legacyOptimizations is set
This commit is contained in:
+15
-3
@@ -297,10 +297,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
`is` in `beforeRegister` as you could in 1.x.
|
||||
*/
|
||||
const proto = this;
|
||||
if (behaviorList) {
|
||||
applyBehaviors(proto, behaviorList, lifecycle);
|
||||
// copy properties lazily if we're optimizing
|
||||
if (Polymer.legacyOptimizations) {
|
||||
copyPropertiesToProto(proto);
|
||||
}
|
||||
applyInfo(proto, info, lifecycle, excludeOnInfo);
|
||||
let list = lifecycle.beforeRegister;
|
||||
if (list) {
|
||||
for (let i=0; i < list.length; i++) {
|
||||
@@ -426,6 +426,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
superBehaviors.concat(behaviors) : behaviorList;
|
||||
}
|
||||
|
||||
const copyPropertiesToProto = (proto) => {
|
||||
if (behaviorList) {
|
||||
applyBehaviors(proto, behaviorList, lifecycle);
|
||||
}
|
||||
applyInfo(proto, info, lifecycle, excludeOnInfo);
|
||||
};
|
||||
|
||||
// copy properties if we're not optimizing
|
||||
if (!Polymer.legacyOptimizations) {
|
||||
copyPropertiesToProto(PolymerGenerated.prototype);
|
||||
}
|
||||
|
||||
PolymerGenerated.generatedFrom = info;
|
||||
|
||||
return PolymerGenerated;
|
||||
|
||||
Reference in New Issue
Block a user