Skip to content

Commit

Permalink
Merge pull request #90 from canjs/no-object-setprototypeof
Browse files Browse the repository at this point in the history
avoiding use of Object.setPrototypeOf
  • Loading branch information
phillipskevin authored Jun 13, 2018
2 parents 9610042 + 68c1adf commit db17d3c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions can-view-callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,15 @@ var tag = function (tagName, tagHandler) {
return Reflect.construct(HTMLElement, [], CustomElement);
};

CustomElement.prototype = Object.create(HTMLElement.prototype);

CustomElement.prototype.connectedCallback = function() {
// don't re-render an element that has been rendered already
if (!renderedElements.has(this)) {
tags[tagName.toLowerCase()](this, {});
}
};

Object.setPrototypeOf(CustomElement.prototype, HTMLElement.prototype);
Object.setPrototypeOf(CustomElement, HTMLElement);

customElements.define(tagName, CustomElement);
}
}
Expand Down

0 comments on commit db17d3c

Please sign in to comment.