Skip to content

Commit

Permalink
remove attachShadow from isBrowserSupported
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Jan 13, 2023
1 parent 6ee9c62 commit 283d0be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/helpers/check-compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export const isBrowserSupported = () => {
&& typeof Array.prototype.includes !== 'undefined'
&& typeof String.prototype.includes !== 'undefined'
&& typeof String.prototype.startsWith !== 'undefined'
&& typeof String.prototype.endsWith !== 'undefined'
&& typeof Element.prototype.attachShadow !== 'undefined';
&& typeof String.prototype.endsWith !== 'undefined';
};

/**
Expand Down
6 changes: 6 additions & 0 deletions src/scriptlets/remove-in-shadow-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ import {
* ```
*/
export function removeInShadowDom(source, selector, baseSelector) {
// do nothing if browser does not support ShadowRoot
// https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot
if (!Element.prototype.attachShadow) {
return;
}

const removeElement = (targetElement) => {
targetElement.remove();
};
Expand Down

0 comments on commit 283d0be

Please sign in to comment.