Skip to content

Commit

Permalink
fix: Removed usage of has()
Browse files Browse the repository at this point in the history
  • Loading branch information
cure53 committed Dec 17, 2020
1 parent 340ca09 commit 7d9bc6a
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions dist/purify.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/purify.cjs.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/purify.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/purify.es.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/purify.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/purify.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/purify.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/purify.min.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/purify.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ function createDOMPurify(window = getGlobal()) {
return (
tagName === 'svg' &&
(parentTagName === 'annotation-xml' ||
MATHML_TEXT_INTEGRATION_POINTS.has(parentTagName))
MATHML_TEXT_INTEGRATION_POINTS[parentTagName])
);
}

Expand All @@ -556,7 +556,7 @@ function createDOMPurify(window = getGlobal()) {
// The only way to switch from SVG to MathML is via
// <math> and HTML integration points
if (parent.namespaceURI === SVG_NAMESPACE) {
return tagName === 'math' && HTML_INTEGRATION_POINTS.has(parentTagName);
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
}

// We only allow elements that are defined in MathML
Expand All @@ -570,14 +570,14 @@ function createDOMPurify(window = getGlobal()) {
// is via MathML text integration points
if (
parent.namespaceURI === SVG_NAMESPACE &&
!HTML_INTEGRATION_POINTS.has(parentTagName)
!HTML_INTEGRATION_POINTS[parentTagName]
) {
return false;
}

if (
parent.namespaceURI === MATHML_NAMESPACE &&
!MATHML_TEXT_INTEGRATION_POINTS.has(parentTagName)
!MATHML_TEXT_INTEGRATION_POINTS[parentTagName]
) {
return false;
}
Expand All @@ -598,7 +598,7 @@ function createDOMPurify(window = getGlobal()) {
// or SVG and should never appear in HTML namespace
return (
!ALL_MATHML_TAGS[tagName] &&
(commonSvgAndHTMLElements.has(tagName) || !ALL_SVG_TAGS[tagName])
(commonSvgAndHTMLElements[tagName] || !ALL_SVG_TAGS[tagName])
);
}

Expand Down

0 comments on commit 7d9bc6a

Please sign in to comment.