Skip to content

Commit 73f2168

Browse files
committed
Moved commonSvgAndHTMLElements out so _checkValidNamespace doesn't re-created in every call
1 parent 23ff095 commit 73f2168

File tree

9 files changed

+47
-47
lines changed

9 files changed

+47
-47
lines changed

dist/purify.cjs.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.cjs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.es.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.es.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/purify.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,18 @@ function createDOMPurify(window = getGlobal()) {
560560
'annotation-xml',
561561
]);
562562

563+
// Certain elements are allowed in both SVG and HTML
564+
// namespace. We need to specify them explicitly
565+
// so that they don't get erroneously deleted from
566+
// HTML namespace.
567+
const commonSvgAndHTMLElements = addToSet({}, [
568+
'title',
569+
'style',
570+
'font',
571+
'a',
572+
'script',
573+
]);
574+
563575
/* Keep track of all possible SVG and MathML tags
564576
* so that we can perform the namespace checks
565577
* correctly. */
@@ -654,18 +666,6 @@ function createDOMPurify(window = getGlobal()) {
654666
return false;
655667
}
656668

657-
// Certain elements are allowed in both SVG and HTML
658-
// namespace. We need to specify them explicitly
659-
// so that they don't get erroneously deleted from
660-
// HTML namespace.
661-
const commonSvgAndHTMLElements = addToSet({}, [
662-
'title',
663-
'style',
664-
'font',
665-
'a',
666-
'script',
667-
]);
668-
669669
// We disallow tags that are specific for MathML
670670
// or SVG and should never appear in HTML namespace
671671
return (

0 commit comments

Comments
 (0)