Skip to content

Commit

Permalink
Allow Polymer({}) calls with ES6 class
Browse files Browse the repository at this point in the history
External copy of cl/228511716
  • Loading branch information
dfreedm committed Jan 9, 2019
1 parent ccc9380 commit 3624a14
Show file tree
Hide file tree
Showing 3 changed files with 693 additions and 939 deletions.
26 changes: 14 additions & 12 deletions lib/legacy/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,20 @@ const excludeOnBehaviors = Object.assign({

function copyProperties(source, target, excludeProps) {
const noAccessors = source._noAccessors;
for (let p in source) {
if (!(p in excludeProps)) {
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);
}
const propertyNames = Object.getOwnPropertyNames(source);
for (let p of propertyNames) {
if (p in excludeProps) {
continue;
}
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);
}
}
}
Expand Down
Loading

0 comments on commit 3624a14

Please sign in to comment.