Skip to content

Commit

Permalink
Attempting a more reasonable fix for #372 and #373
Browse files Browse the repository at this point in the history
  • Loading branch information
cure53 committed Oct 21, 2019
1 parent 967af07 commit 3a30371
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 17 deletions.
3 changes: 0 additions & 3 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.

3 changes: 0 additions & 3 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.

3 changes: 0 additions & 3 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.

3 changes: 0 additions & 3 deletions src/purify.js
Expand Up @@ -486,9 +486,6 @@ function createDOMPurify(window = getGlobal()) {
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
const matches = dirty.match(/^[\s]+/);
leadingWhitespace = matches && matches[0];
if (leadingWhitespace) {
dirty = dirty.slice(leadingWhitespace.length);
}
}

/* Use DOMParser to workaround Firefox bug (see comment below) */
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/expect.js
Expand Up @@ -1074,5 +1074,11 @@ module.exports = [
"<svg><b><style><b></b></style></b></svg>",
"<svg></svg><b><style><b title='</style><img>'&gt;</b>"
]
}, {
"title": "Tests against proper handling of leading whitespaces",
"payload": " ",
"expected": [
" "
]
}
];

0 comments on commit 3a30371

Please sign in to comment.