1
- diff --git a/node_modules/dompurify/dist/purify.es.js b/node_modules/dompurify/dist/purify.es.js
2
- index ee9246e..d297e22 100644
3
- --- a/node_modules/dompurify/dist/purify.es.js
4
- +++ b/node_modules/dompurify/dist/purify.es.js
5
- @@ -1190,6 +1190,7 @@ function createDOMPurify() {
6
- namespaceURI
1
+ diff --git a/node_modules/dompurify/dist/purify.es.mjs b/node_modules/dompurify/dist/purify.es.mjs
2
+ index 86186cf..710e443 100644
3
+ --- a/node_modules/dompurify/dist/purify.es.mjs
4
+ +++ b/node_modules/dompurify/dist/purify.es.mjs
5
+ @@ -1054,6 +1054,7 @@ function createDOMPurify() {
7
6
} = attr;
8
- value = name === 'value' ? attr.value : stringTrim(attr.value);
7
+ const lcName = transformCaseFunc(name);
8
+ let value = name === 'value' ? attrValue : stringTrim(attrValue);
9
9
+ const initValue = value;
10
- lcName = transformCaseFunc(name);
11
10
/* Execute a hook if present */
12
-
13
- @@ -1209,11 +1210,11 @@ function createDOMPurify() {
11
+ hookEvent.attrName = lcName;
12
+ hookEvent.attrValue = value;
13
+ @@ -1080,9 +1081,10 @@ function createDOMPurify() {
14
+ continue;
15
+ }
14
16
/* Remove attribute */
15
-
16
-
17
17
- _removeAttribute(name, currentNode);
18
+ + /* (Removal deferred until after hook check) */
18
19
/* Did the hooks approve of the attribute? */
19
-
20
-
21
20
if (!hookEvent.keepAttr) {
22
21
+ _removeAttribute(name, currentNode);
23
22
continue;
24
23
}
25
24
/* Work around a security issue in jQuery 3.0 */
26
- @@ -1238,6 +1239,7 @@ function createDOMPurify() {
25
+ @@ -1099,6 +1101,7 @@ function createDOMPurify() {
26
+ /* Is `value` valid for this attribute? */
27
27
const lcTag = transformCaseFunc(currentNode.nodeName);
28
-
29
28
if (!_isValidAttribute(lcTag, lcName, value)) {
30
29
+ _removeAttribute(name, currentNode);
31
30
continue;
32
31
}
33
- /* Full DOM Clobbering protection via namespace isolation,
34
- @@ -1274,17 +1276,18 @@ function createDOMPurify() {
32
+ /* Handle attributes that require Trusted Types */
33
+ @@ -1119,19 +1122,22 @@ function createDOMPurify() {
34
+ }
35
35
}
36
36
/* Handle invalid data-* attribute set by try-catching it */
37
-
38
- -
39
37
- try {
40
38
- if (namespaceURI) {
41
39
- currentNode.setAttributeNS(namespaceURI, name, value);
42
40
- } else {
43
41
- /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
44
42
- currentNode.setAttribute(name, value);
43
+ - }
44
+ - if (_isClobbered(currentNode)) {
45
+ - _forceRemove(currentNode);
46
+ - } else {
47
+ - arrayPop(DOMPurify.removed);
45
48
+ if (value !== initValue) {
46
49
+ try {
47
50
+ if (namespaceURI) {
@@ -50,60 +53,65 @@ index ee9246e..d297e22 100644
50
53
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
51
54
+ currentNode.setAttribute(name, value);
52
55
+ }
56
+ + if (_isClobbered(currentNode)) {
57
+ + _forceRemove(currentNode);
58
+ + } else {
59
+ + arrayPop(DOMPurify.removed);
60
+ + }
53
61
+ } catch (_) {
54
- + _removeAttribute(name, currentNode);
55
62
}
56
- -
57
- - arrayPop(DOMPurify.removed);
58
63
- } catch (_) {}
59
64
+ }
60
65
}
61
66
/* Execute a hook if present */
62
-
67
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
63
68
diff --git a/node_modules/dompurify/dist/purify.js b/node_modules/dompurify/dist/purify.js
64
- index ba807e1..c6512fc 100644
69
+ index a03f326..d5d7424 100644
65
70
--- a/node_modules/dompurify/dist/purify.js
66
71
+++ b/node_modules/dompurify/dist/purify.js
67
- @@ -1196,6 +1196,7 @@
68
- namespaceURI
72
+ @@ -1060,6 +1060,7 @@
69
73
} = attr;
70
- value = name === 'value' ? attr.value : stringTrim(attr.value);
74
+ const lcName = transformCaseFunc(name);
75
+ let value = name === 'value' ? attrValue : stringTrim(attrValue);
71
76
+ const initValue = value;
72
- lcName = transformCaseFunc(name);
73
77
/* Execute a hook if present */
74
-
75
- @@ -1215,11 +1216,10 @@
78
+ hookEvent.attrName = lcName;
79
+ hookEvent.attrValue = value;
80
+ @@ -1086,9 +1087,10 @@
81
+ continue;
82
+ }
76
83
/* Remove attribute */
77
-
78
-
79
84
- _removeAttribute(name, currentNode);
85
+ + /* (Initial removal deferred until after hook check) */
80
86
/* Did the hooks approve of the attribute? */
81
-
82
- -
83
87
if (!hookEvent.keepAttr) {
84
88
+ _removeAttribute(name, currentNode);
85
89
continue;
86
90
}
87
91
/* Work around a security issue in jQuery 3.0 */
88
- @@ -1244,6 +1244,7 @@
92
+ @@ -1105,6 +1107,7 @@
93
+ /* Is `value` valid for this attribute? */
89
94
const lcTag = transformCaseFunc(currentNode.nodeName);
90
-
91
95
if (!_isValidAttribute(lcTag, lcName, value)) {
92
96
+ _removeAttribute(name, currentNode);
93
97
continue;
94
98
}
95
- /* Full DOM Clobbering protection via namespace isolation,
96
- @@ -1280,17 +1281,18 @@
99
+ /* Handle attributes that require Trusted Types */
100
+ @@ -1125,19 +1128,22 @@
101
+ }
97
102
}
98
103
/* Handle invalid data-* attribute set by try-catching it */
99
-
100
- -
101
104
- try {
102
105
- if (namespaceURI) {
103
106
- currentNode.setAttributeNS(namespaceURI, name, value);
104
107
- } else {
105
108
- /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
106
109
- currentNode.setAttribute(name, value);
110
+ - }
111
+ - if (_isClobbered(currentNode)) {
112
+ - _forceRemove(currentNode);
113
+ - } else {
114
+ - arrayPop(DOMPurify.removed);
107
115
+ if (value !== initValue) {
108
116
+ try {
109
117
+ if (namespaceURI) {
@@ -112,13 +120,15 @@ index ba807e1..c6512fc 100644
112
120
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
113
121
+ currentNode.setAttribute(name, value);
114
122
+ }
123
+ + if (_isClobbered(currentNode)) {
124
+ + _forceRemove(currentNode);
125
+ + } else {
126
+ + arrayPop(DOMPurify.removed);
127
+ + }
115
128
+ } catch (_) {
116
- + _removeAttribute(name, currentNode);
117
129
}
118
- -
119
- - arrayPop(DOMPurify.removed);
120
130
- } catch (_) {}
121
131
+ }
122
132
}
123
133
/* Execute a hook if present */
124
-
134
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
0 commit comments