From 5b34ce9d8321e60cf46bc07205d02eb5f9b5abf6 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Fri, 9 Nov 2018 11:39:10 -0800 Subject: [PATCH] Avoid copying certain properties from behaviors This better matches what Polymer 1.x did for: * hostAttributes * listeners * properties * observers --- lib/legacy/class.html | 33 ++++++++++++++++++++++----------- test/unit/behaviors.html | 21 +++++++++++++++++++++ 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/lib/legacy/class.html b/lib/legacy/class.html index 4269b002ea..bed2211d53 100644 --- a/lib/legacy/class.html +++ b/lib/legacy/class.html @@ -14,7 +14,7 @@ 'use strict'; - const metaProps = { + const lifecycleProps = { attached: true, detached: true, ready: true, @@ -22,18 +22,29 @@ beforeRegister: true, registered: true, attributeChanged: true, + listeners: true, + hostAttributes: true }; - const excludeProps = Object.assign({ + const excludeOnInfo = { + attached: true, + detached: true, + ready: true, + created: true, + beforeRegister: true, + registered: true, + attributeChanged: true, behaviors: true - }, metaProps); + }; - const lifecycleProps = Object.assign({ + const excludeOnBehaviors = Object.assign({ listeners: true, - hostAttributes: true - }, metaProps); + hostAttributes: true, + properties: true, + observers: true, + }, excludeOnInfo); - function copyProperties(source, target) { + function copyProperties(source, target, excludeProps) { for (let p in source) { // NOTE: cannot copy `excludeProps` methods onto prototype at least because // `super.ready` must be called and is not included in the user fn. @@ -97,12 +108,12 @@ // (again same as 1.x) function applyBehaviors(proto, behaviors, lifecycle) { for (let i=0; i @@ -434,6 +441,12 @@ + + + +