Skip to content

Commit

Permalink
fix: Adjusted the list of permitted SVG HTML integration points
Browse files Browse the repository at this point in the history
test: Adjusted the tests to reflect the expected behavior
  • Loading branch information
cure53 committed Apr 29, 2024
1 parent 61b761f commit 8075b37
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion dist/purify.es.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ function createDOMPurify() {
CONFIG = cfg;
};
const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']);
const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'annotation-xml']);

// Certain elements are allowed in both SVG and HTML
// namespace. We need to specify them explicitly
Expand Down
2 changes: 1 addition & 1 deletion dist/purify.es.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 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.

2 changes: 0 additions & 2 deletions src/purify.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,6 @@ function createDOMPurify(window = getGlobal()) {

const HTML_INTEGRATION_POINTS = addToSet({}, [
'foreignobject',
'desc',
'title',
'annotation-xml',
]);

Expand Down
8 changes: 4 additions & 4 deletions test/test-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -1709,8 +1709,8 @@
test:
'<svg><desc><canvas></canvas><textarea></textarea></desc></svg>',
expected: [
'<svg><desc><canvas></canvas><textarea></textarea></desc></svg>',
'<svg xmlns="http://www.w3.org/2000/svg"><desc><canvas></canvas><textarea></textarea></desc></svg>',
'<svg><desc></desc></svg>',
'<svg xmlns="http://www.w3.org/2000/svg"><desc></desc></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" />',
],
},
Expand All @@ -1735,9 +1735,9 @@
{
test: '<svg><math></math><title><math></math></title></svg>',
expected: [
'<svg><title><math></math></title></svg>',
'<svg><title></title></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" />',
'<svg xmlns="http://www.w3.org/2000/svg"><title><math></math></title></svg>',
'<svg xmlns="http://www.w3.org/2000/svg"><title></title></svg>',
],
},
{
Expand Down

0 comments on commit 8075b37

Please sign in to comment.