Skip to content

Commit

Permalink
Merge 8b8b12c into 9523683
Browse files Browse the repository at this point in the history
  • Loading branch information
diasbruno committed May 14, 2021
2 parents 9523683 + 8b8b12c commit 5ef329e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/helpers/safeHTMLElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@ import ExecutionEnvironment from "exenv";

const EE = ExecutionEnvironment;

const SafeHTMLElement = EE.canUseDOM ? window.HTMLElement : {};
const NodeTypeElement = 1;

const IHTMLElement = function(props, propName) {
const element = props[propName];
return (
element.nodeType === NodeTypeElement &&
element.setAttribute &&
element.removeAttribute
);
};

const SafeHTMLElement = EE.canUseDOM ? IHTMLElement : {};

export const SafeHTMLCollection = EE.canUseDOM ? window.HTMLCollection : {};

Expand Down

0 comments on commit 5ef329e

Please sign in to comment.