hoeditor-web 0.3.63 → 0.3.67
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/lib/hoeditor.common.1.js +6280 -15076
- package/lib/hoeditor.common.2.js +43 -10
- package/lib/hoeditor.common.3.js +2284 -1777
- package/lib/hoeditor.common.js +3548 -2039
- package/lib/hoeditor.css +2 -2
- package/lib/hoeditor.umd.1.js +6280 -15076
- package/lib/hoeditor.umd.2.js +43 -10
- package/lib/hoeditor.umd.3.js +2284 -1777
- package/lib/hoeditor.umd.js +3548 -2039
- package/lib/hoeditor.umd.min.1.js +2 -2
- package/lib/hoeditor.umd.min.2.js +2 -2
- package/lib/hoeditor.umd.min.3.js +2 -2
- package/lib/hoeditor.umd.min.js +79 -261
- package/package.json +1 -1
package/lib/hoeditor.common.2.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/***/ "c0c4":
|
|
4
4
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5
5
|
|
|
6
|
-
/*! @license DOMPurify 2.3.
|
|
6
|
+
/*! @license DOMPurify 2.3.2 | (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.2/LICENSE */
|
|
7
7
|
|
|
8
8
|
(function (global, factory) {
|
|
9
9
|
true ? module.exports = factory() :
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
* Version label, exposed for easier checks
|
|
254
254
|
* if DOMPurify is up to date or not
|
|
255
255
|
*/
|
|
256
|
-
DOMPurify.version = '2.3.
|
|
256
|
+
DOMPurify.version = '2.3.2';
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
259
|
* Array of elements that DOMPurify removed during sanitation.
|
|
@@ -419,7 +419,8 @@
|
|
|
419
419
|
var USE_PROFILES = {};
|
|
420
420
|
|
|
421
421
|
/* Tags to ignore content of when KEEP_CONTENT is true */
|
|
422
|
-
var FORBID_CONTENTS =
|
|
422
|
+
var FORBID_CONTENTS = null;
|
|
423
|
+
var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
423
424
|
|
|
424
425
|
/* Tags that are safe for data: URIs */
|
|
425
426
|
var DATA_URI_TAGS = null;
|
|
@@ -427,7 +428,7 @@
|
|
|
427
428
|
|
|
428
429
|
/* Attributes safe for values like "javascript:" */
|
|
429
430
|
var URI_SAFE_ATTRIBUTES = null;
|
|
430
|
-
var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'summary', 'title', 'value', 'style', 'xmlns']);
|
|
431
|
+
var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
|
|
431
432
|
|
|
432
433
|
var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
433
434
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
@@ -436,6 +437,12 @@
|
|
|
436
437
|
var NAMESPACE = HTML_NAMESPACE;
|
|
437
438
|
var IS_EMPTY_INPUT = false;
|
|
438
439
|
|
|
440
|
+
/* Parsing of strict XHTML documents */
|
|
441
|
+
var PARSER_MEDIA_TYPE = void 0;
|
|
442
|
+
var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
|
|
443
|
+
var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
|
|
444
|
+
var transformCaseFunc = void 0;
|
|
445
|
+
|
|
439
446
|
/* Keep a reference to config to pass to hooks */
|
|
440
447
|
var CONFIG = null;
|
|
441
448
|
|
|
@@ -468,6 +475,7 @@
|
|
|
468
475
|
ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
|
|
469
476
|
URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
470
477
|
DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS;
|
|
478
|
+
FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS;
|
|
471
479
|
FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};
|
|
472
480
|
FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};
|
|
473
481
|
USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
|
|
@@ -486,6 +494,12 @@
|
|
|
486
494
|
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
487
495
|
IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1;
|
|
488
496
|
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
497
|
+
PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE in SUPPORTED_PARSER_MEDIA_TYPES ? cfg.PARSER_MEDIA_TYPE : DEFAULT_PARSER_MEDIA_TYPE;
|
|
498
|
+
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
499
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
|
|
500
|
+
return x;
|
|
501
|
+
} : stringToLowerCase;
|
|
502
|
+
|
|
489
503
|
if (SAFE_FOR_TEMPLATES) {
|
|
490
504
|
ALLOW_DATA_ATTR = false;
|
|
491
505
|
}
|
|
@@ -543,6 +557,14 @@
|
|
|
543
557
|
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
|
|
544
558
|
}
|
|
545
559
|
|
|
560
|
+
if (cfg.FORBID_CONTENTS) {
|
|
561
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
562
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS);
|
|
566
|
+
}
|
|
567
|
+
|
|
546
568
|
/* Add #text in case KEEP_CONTENT is set to true */
|
|
547
569
|
if (KEEP_CONTENT) {
|
|
548
570
|
ALLOWED_TAGS['#text'] = true;
|
|
@@ -746,6 +768,11 @@
|
|
|
746
768
|
leadingWhitespace = matches && matches[0];
|
|
747
769
|
}
|
|
748
770
|
|
|
771
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {
|
|
772
|
+
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
|
773
|
+
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
|
|
774
|
+
}
|
|
775
|
+
|
|
749
776
|
var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
750
777
|
/*
|
|
751
778
|
* Use the DOMParser API by default, fallback later if needs be
|
|
@@ -753,7 +780,7 @@
|
|
|
753
780
|
*/
|
|
754
781
|
if (NAMESPACE === HTML_NAMESPACE) {
|
|
755
782
|
try {
|
|
756
|
-
doc = new DOMParser().parseFromString(dirtyPayload,
|
|
783
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
757
784
|
} catch (_) {}
|
|
758
785
|
}
|
|
759
786
|
|
|
@@ -866,7 +893,7 @@
|
|
|
866
893
|
}
|
|
867
894
|
|
|
868
895
|
/* Now let's check the element's type and name */
|
|
869
|
-
var tagName =
|
|
896
|
+
var tagName = transformCaseFunc(currentNode.nodeName);
|
|
870
897
|
|
|
871
898
|
/* Execute a hook if present */
|
|
872
899
|
_executeHook('uponSanitizeElement', currentNode, {
|
|
@@ -880,6 +907,12 @@
|
|
|
880
907
|
return true;
|
|
881
908
|
}
|
|
882
909
|
|
|
910
|
+
/* Mitigate a problem with templates inside select */
|
|
911
|
+
if (tagName === 'select' && regExpTest(/<template/i, currentNode.innerHTML)) {
|
|
912
|
+
_forceRemove(currentNode);
|
|
913
|
+
return true;
|
|
914
|
+
}
|
|
915
|
+
|
|
883
916
|
/* Remove element if anything forbids its presence */
|
|
884
917
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
885
918
|
/* Keep content except for bad-listed elements */
|
|
@@ -1001,7 +1034,7 @@
|
|
|
1001
1034
|
namespaceURI = _attr.namespaceURI;
|
|
1002
1035
|
|
|
1003
1036
|
value = stringTrim(attr.value);
|
|
1004
|
-
lcName =
|
|
1037
|
+
lcName = transformCaseFunc(name);
|
|
1005
1038
|
|
|
1006
1039
|
/* Execute a hook if present */
|
|
1007
1040
|
hookEvent.attrName = lcName;
|
|
@@ -1036,7 +1069,7 @@
|
|
|
1036
1069
|
}
|
|
1037
1070
|
|
|
1038
1071
|
/* Is `value` valid for this attribute? */
|
|
1039
|
-
var lcTag = currentNode.nodeName
|
|
1072
|
+
var lcTag = transformCaseFunc(currentNode.nodeName);
|
|
1040
1073
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
1041
1074
|
continue;
|
|
1042
1075
|
}
|
|
@@ -1299,8 +1332,8 @@
|
|
|
1299
1332
|
_parseConfig({});
|
|
1300
1333
|
}
|
|
1301
1334
|
|
|
1302
|
-
var lcTag =
|
|
1303
|
-
var lcName =
|
|
1335
|
+
var lcTag = transformCaseFunc(tag);
|
|
1336
|
+
var lcName = transformCaseFunc(attr);
|
|
1304
1337
|
return _isValidAttribute(lcTag, lcName, value);
|
|
1305
1338
|
};
|
|
1306
1339
|
|