diff --git a/lib/legacy/class.html b/lib/legacy/class.html index bed2211d53..ad6817a7fb 100644 --- a/lib/legacy/class.html +++ b/lib/legacy/class.html @@ -34,7 +34,8 @@ beforeRegister: true, registered: true, attributeChanged: true, - behaviors: true + behaviors: true, + _noAccessors: true }; const excludeOnBehaviors = Object.assign({ @@ -45,13 +46,19 @@ }, excludeOnInfo); function copyProperties(source, target, excludeProps) { + const noAccessors = source._noAccessors; 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. if (!(p in excludeProps)) { - let pd = Object.getOwnPropertyDescriptor(source, p); - if (pd) { - Object.defineProperty(target, p, pd); + if (noAccessors) { + target[p] = source[p]; + } else { + let pd = Object.getOwnPropertyDescriptor(source, p); + if (pd) { + // ensure property is configurable so that a later behavior can + // re-configure it. + pd.configurable = true; + Object.defineProperty(target, p, pd); + } } } } diff --git a/test/unit/behaviors.html b/test/unit/behaviors.html index 4cafee3c28..b08dfd5dee 100644 --- a/test/unit/behaviors.html +++ b/test/unit/behaviors.html @@ -378,6 +378,20 @@ behaviors: [window.BehaviorA] }); + Polymer({ + is: 'no-accessors-behavior', + behaviors: [{ + _noAccessors: true, + properties: { + nug: String + }, + foo: function() {}, + bar: true + }], + _noAccessors: true, + zot: 'zot' + }); + }); @@ -447,6 +461,12 @@ + + + +