Skip to content

Commit 055893e

Browse files
committed
pat-validation: Simplify the dompurify import.
There should be no need to cache the import, as browsers, bundler and their module import system already to import caching.
1 parent 064fd24 commit 055893e

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

src/pat/validation/validation.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ class Pattern extends BasePattern {
4242
// validation fails (e.g. pat-inject).
4343
static order = 100;
4444

45-
_dompurify = null;
46-
async get_dompurify() {
47-
if (!this._dompurify) {
48-
this._dompurify = (await import("dompurify")).default;
49-
}
50-
return this._dompurify;
51-
}
52-
5345
init() {
5446
events.add_event_listener(
5547
this.el,
@@ -406,7 +398,7 @@ class Pattern extends BasePattern {
406398
// executed. Chrome includes the input value in it's browser validation
407399
// message. When placing that into the DOM, malicious input could get
408400
// executed within the web page context.
409-
const dompurify = await this.get_dompurify();
401+
const dompurify = (await import("dompurify")).default;
410402
const validation_message = dompurify.sanitize(
411403
input.validationMessage || input[KEY_ERROR_MSG]
412404
);

0 commit comments

Comments
 (0)