Skip to content

Commit

Permalink
fix: Made use of proper helper method to get parentNode
Browse files Browse the repository at this point in the history
test: fixed several more MSIE11 tests
  • Loading branch information
cure53 committed Dec 17, 2020
1 parent 7e3a705 commit 8e29990
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 13 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.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.

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: 1 addition & 1 deletion src/purify.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ function createDOMPurify(window = getGlobal()) {
* return. Return true otherwise.
*/
const _checkValidNamespace = function (element) {
let parent = element.parentNode;
let parent = getParentNode(element);

// In JSDOM, if we're inside shadow DOM, then parentNode
// can be null. We just simulate parent in this case.
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ module.exports = [
"<svg></svg><p></p><title>&lt;a id=\"</title><img src=\"x\">\"&gt;",
"<svg><title><a id=\"</title><img src=x onerror=alert()>\"></a></title></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title><a id=\"</title><img src=x onerror=alert()>\"></a></title></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\" />"
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title><a id=\"</title><img src=x onerror=alert()>\"></a></title></title></svg></svg>"
]
}, {
"title": "Tests against mXSS behavior with MathML in Chrome 77 and alike",
Expand All @@ -1042,7 +1042,7 @@ module.exports = [
"<svg></svg><p></p><img src=\"x\">",
"<svg><title><template></template></title></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title><template></template></title></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\" />"
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title><template></template></title></title></svg></svg>"
]
}, {
"title": "Tests against mXSS behavior with MathML Templates in Chrome 77 and alike",
Expand Down
4 changes: 2 additions & 2 deletions test/test-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ module.exports = function (DOMPurify, window, tests, xssTests) {
"<svg></svg><p></p>",
"<svg><style></style></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\"><style /></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\" />"
"<svg xmlns=\"http://www.w3.org/2000/svg\"><style /></svg></svg>"
]);
});
QUnit.test('Avoid mXSS in Chrome 77 and above using HTML', function (assert) {
Expand All @@ -1251,7 +1251,7 @@ module.exports = function (DOMPurify, window, tests, xssTests) {
"<svg></svg><p></p>qqq",
"<svg><title></title></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title /></svg>",
"<svg xmlns=\"http://www.w3.org/2000/svg\" />"
"<svg xmlns=\"http://www.w3.org/2000/svg\"><title /></svg></svg>"
]);
});
QUnit.test(
Expand Down

0 comments on commit 8e29990

Please sign in to comment.