dompurify 2.3.8 → 2.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/purify.cjs.js +31 -22
- package/dist/purify.cjs.js.map +1 -1
- package/dist/purify.es.js +31 -22
- package/dist/purify.es.js.map +1 -1
- package/dist/purify.js +31 -22
- package/dist/purify.js.map +1 -1
- package/dist/purify.min.js +2 -2
- package/dist/purify.min.js.map +1 -1
- package/package.json +1 -1
package/dist/purify.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @license DOMPurify 2.3.
|
|
1
|
+
/*! @license DOMPurify 2.3.9 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.9/LICENSE */
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) {
|
|
4
4
|
"@babel/helpers - typeof";
|
|
@@ -149,7 +149,9 @@ function unconstruct(func) {
|
|
|
149
149
|
}
|
|
150
150
|
/* Add properties to a lookup table */
|
|
151
151
|
|
|
152
|
-
function addToSet(set, array) {
|
|
152
|
+
function addToSet(set, array, transformCaseFunc) {
|
|
153
|
+
transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase;
|
|
154
|
+
|
|
153
155
|
if (setPrototypeOf) {
|
|
154
156
|
// Make 'in' and truthy checks like Boolean(set.constructor)
|
|
155
157
|
// independent of any properties defined on Object.prototype.
|
|
@@ -163,7 +165,7 @@ function addToSet(set, array) {
|
|
|
163
165
|
var element = array[l];
|
|
164
166
|
|
|
165
167
|
if (typeof element === 'string') {
|
|
166
|
-
var lcElement =
|
|
168
|
+
var lcElement = transformCaseFunc(element);
|
|
167
169
|
|
|
168
170
|
if (lcElement !== element) {
|
|
169
171
|
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
|
@@ -315,7 +317,7 @@ function createDOMPurify() {
|
|
|
315
317
|
*/
|
|
316
318
|
|
|
317
319
|
|
|
318
|
-
DOMPurify.version = '2.3.
|
|
320
|
+
DOMPurify.version = '2.3.9';
|
|
319
321
|
/**
|
|
320
322
|
* Array of elements that DOMPurify removed during sanitation.
|
|
321
323
|
* Empty if nothing was removed.
|
|
@@ -545,15 +547,29 @@ function createDOMPurify() {
|
|
|
545
547
|
|
|
546
548
|
|
|
547
549
|
cfg = clone(cfg);
|
|
550
|
+
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
|
|
551
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
552
|
+
|
|
553
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
|
|
554
|
+
return x;
|
|
555
|
+
} : stringToLowerCase;
|
|
548
556
|
/* Set configuration parameters */
|
|
549
557
|
|
|
550
|
-
ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
|
|
551
|
-
ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
|
|
552
|
-
URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
558
|
+
ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
559
|
+
ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
560
|
+
URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
|
|
561
|
+
cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
|
|
562
|
+
transformCaseFunc // eslint-disable-line indent
|
|
563
|
+
) // eslint-disable-line indent
|
|
564
|
+
: DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
565
|
+
DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
|
|
566
|
+
cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
|
|
567
|
+
transformCaseFunc // eslint-disable-line indent
|
|
568
|
+
) // eslint-disable-line indent
|
|
569
|
+
: DEFAULT_DATA_URI_TAGS;
|
|
570
|
+
FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
571
|
+
FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
572
|
+
FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
557
573
|
USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
|
|
558
574
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
559
575
|
|
|
@@ -594,13 +610,6 @@ function createDOMPurify() {
|
|
|
594
610
|
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
|
595
611
|
}
|
|
596
612
|
|
|
597
|
-
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
|
|
598
|
-
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
599
|
-
|
|
600
|
-
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
|
|
601
|
-
return x;
|
|
602
|
-
} : stringToLowerCase;
|
|
603
|
-
|
|
604
613
|
if (SAFE_FOR_TEMPLATES) {
|
|
605
614
|
ALLOW_DATA_ATTR = false;
|
|
606
615
|
}
|
|
@@ -646,7 +655,7 @@ function createDOMPurify() {
|
|
|
646
655
|
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
647
656
|
}
|
|
648
657
|
|
|
649
|
-
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
|
|
658
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
650
659
|
}
|
|
651
660
|
|
|
652
661
|
if (cfg.ADD_ATTR) {
|
|
@@ -654,11 +663,11 @@ function createDOMPurify() {
|
|
|
654
663
|
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
655
664
|
}
|
|
656
665
|
|
|
657
|
-
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
|
|
666
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
658
667
|
}
|
|
659
668
|
|
|
660
669
|
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
661
|
-
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
|
|
670
|
+
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
662
671
|
}
|
|
663
672
|
|
|
664
673
|
if (cfg.FORBID_CONTENTS) {
|
|
@@ -666,7 +675,7 @@ function createDOMPurify() {
|
|
|
666
675
|
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
667
676
|
}
|
|
668
677
|
|
|
669
|
-
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS);
|
|
678
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
670
679
|
}
|
|
671
680
|
/* Add #text in case KEEP_CONTENT is set to true */
|
|
672
681
|
|