Skip to content

Commit

Permalink
fix: move attachShadow override to Element per spec
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdwilliams committed Sep 25, 2020
1 parent d8faa40 commit 1e11b32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ export function initAdoptedStyleSheets() {
);

if (typeof ShadowRoot !== 'undefined') {
const {attachShadow} = HTMLElement.prototype;
const {attachShadow} = Element.prototype;

// Shadow root of each element should be observed to add styles to all
// elements added to this root.
HTMLElement.prototype.attachShadow = function() {
Element.prototype.attachShadow = function() {
// In case we have ShadowDOM emulation, we have to use element itself
// instead of the ShadowRoot
const location = hasShadyCss ? this : attachShadow.apply(this, arguments);
Expand Down

0 comments on commit 1e11b32

Please sign in to comment.