Skip to content

Commit

Permalink
fix: Merged relevant changes from main for 2.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
cure53 committed Mar 21, 2024
1 parent 416ba67 commit 0940755
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 13 deletions.
12 changes: 10 additions & 2 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.

12 changes: 10 additions & 2 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.

12 changes: 10 additions & 2 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.

9 changes: 8 additions & 1 deletion src/purify.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,8 @@ function createDOMPurify(window = getGlobal()) {
NodeFilter.SHOW_ELEMENT |
NodeFilter.SHOW_COMMENT |
NodeFilter.SHOW_TEXT |
NodeFilter.SHOW_PROCESSING_INSTRUCTION,
NodeFilter.SHOW_PROCESSING_INSTRUCTION |
NodeFilter.SHOW_CDATA_SECTION,
null,
false
);
Expand Down Expand Up @@ -1012,6 +1013,12 @@ function createDOMPurify(window = getGlobal()) {
return true;
}

/* Remove any ocurrence of processing instructions */
if (currentNode.nodeType === 7) {
_forceRemove(currentNode);
return true;
}

/* Remove element if anything forbids its presence */
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
/* Check if we have a custom element to handle */
Expand Down
2 changes: 1 addition & 1 deletion src/regexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export const ATTR_WHITESPACE = seal(
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
);
export const DOCTYPE_NAME = seal(/^html$/i);
export const CUSTOM_ELEMENT = seal(/^[a-z][a-z\d]*(-[a-z\d]+)+$/i);
export const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);

0 comments on commit 0940755

Please sign in to comment.