diff options
| author | Johann-S <[email protected]> | 2021-02-17 08:22:44 +0100 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2021-09-15 16:42:04 +0200 |
| commit | d73d835380f793ab7ca40b82a6ce09ba8f5946c5 (patch) | |
| tree | 7c98a87a596ae937983498980afb6e2fa239ab53 /js/src/util/sanitizer.js | |
| parent | bdfb4cc54d29c0c7bcd7944d3c8de2e1cd41bb6c (diff) | |
| download | bootstrap-jo-ssr-friendly.tar.xz bootstrap-jo-ssr-friendly.zip | |
being ssr friendly when accessing dom objectsjo-ssr-friendly
Diffstat (limited to 'js/src/util/sanitizer.js')
| -rw-r--r-- | js/src/util/sanitizer.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js index 11b28a9d9..9df43142a 100644 --- a/js/src/util/sanitizer.js +++ b/js/src/util/sanitizer.js @@ -5,6 +5,8 @@ * -------------------------------------------------------------------------- */ +import { getWindow } from './index' + const uriAttributes = new Set([ 'background', 'cite', @@ -98,7 +100,8 @@ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) { return sanitizeFn(unsafeHtml) } - const domParser = new window.DOMParser() + const windowRef = getWindow() + const domParser = new windowRef.DOMParser() const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html') const elements = [].concat(...createdDocument.body.querySelectorAll('*')) |
