hoeditor-web 2.0.115 → 2.0.116

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.
@@ -3,7 +3,7 @@
3
3
  /***/ 27856:
4
4
  /***/ (function(module) {
5
5
 
6
- /*! @license DOMPurify 2.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.0/LICENSE */
6
+ /*! @license DOMPurify 2.4.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.1/LICENSE */
7
7
 
8
8
  (function (global, factory) {
9
9
  true ? module.exports = factory() :
@@ -133,6 +133,7 @@
133
133
  var arrayPop = unapply(Array.prototype.pop);
134
134
  var arrayPush = unapply(Array.prototype.push);
135
135
  var stringToLowerCase = unapply(String.prototype.toLowerCase);
136
+ var stringToString = unapply(String.prototype.toString);
136
137
  var stringMatch = unapply(String.prototype.match);
137
138
  var stringReplace = unapply(String.prototype.replace);
138
139
  var stringIndexOf = unapply(String.prototype.indexOf);
@@ -259,6 +260,7 @@
259
260
  var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
260
261
 
261
262
  var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
263
+ var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
262
264
  var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
263
265
 
264
266
  var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
@@ -330,7 +332,7 @@
330
332
  */
331
333
 
332
334
 
333
- DOMPurify.version = '2.4.0';
335
+ DOMPurify.version = '2.4.1';
334
336
  /**
335
337
  * Array of elements that DOMPurify removed during sanitation.
336
338
  * Empty if nothing was removed.
@@ -399,6 +401,7 @@
399
401
  DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;
400
402
  var MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
401
403
  ERB_EXPR$1 = ERB_EXPR,
404
+ TMPLIT_EXPR$1 = TMPLIT_EXPR,
402
405
  DATA_ATTR$1 = DATA_ATTR,
403
406
  ARIA_ATTR$1 = ARIA_ATTR,
404
407
  IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
@@ -538,6 +541,10 @@
538
541
 
539
542
  var NAMESPACE = HTML_NAMESPACE;
540
543
  var IS_EMPTY_INPUT = false;
544
+ /* Allowed XHTML+XML namespaces */
545
+
546
+ var ALLOWED_NAMESPACES = null;
547
+ var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
541
548
  /* Parsing of strict XHTML documents */
542
549
 
543
550
  var PARSER_MEDIA_TYPE;
@@ -581,13 +588,12 @@
581
588
  PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
582
589
  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.
583
590
 
584
- transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
585
- return x;
586
- } : stringToLowerCase;
591
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
587
592
  /* Set configuration parameters */
588
593
 
589
594
  ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
590
595
  ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
596
+ ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
591
597
  URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
592
598
  cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
593
599
  transformCaseFunc // eslint-disable-line indent
@@ -770,7 +776,7 @@
770
776
 
771
777
  if (!parent || !parent.tagName) {
772
778
  parent = {
773
- namespaceURI: HTML_NAMESPACE,
779
+ namespaceURI: NAMESPACE,
774
780
  tagName: 'template'
775
781
  };
776
782
  }
@@ -778,13 +784,17 @@
778
784
  var tagName = stringToLowerCase(element.tagName);
779
785
  var parentTagName = stringToLowerCase(parent.tagName);
780
786
 
787
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
788
+ return false;
789
+ }
790
+
781
791
  if (element.namespaceURI === SVG_NAMESPACE) {
782
792
  // The only way to switch from HTML namespace to SVG
783
793
  // is via <svg>. If it happens via any other tag, then
784
794
  // it should be killed.
785
795
  if (parent.namespaceURI === HTML_NAMESPACE) {
786
796
  return tagName === 'svg';
787
- } // The only way to switch from MathML to SVG is via
797
+ } // The only way to switch from MathML to SVG is via`
788
798
  // svg if parent is either <annotation-xml> or MathML
789
799
  // text integration points.
790
800
 
@@ -832,9 +842,15 @@
832
842
 
833
843
 
834
844
  return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
845
+ } // For XHTML and XML documents that support custom namespaces
846
+
847
+
848
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
849
+ return true;
835
850
  } // The code should never reach this place (this means
836
851
  // that the element somehow got namespace that is not
837
- // HTML, SVG or MathML). Return false just in case.
852
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
853
+ // Return false just in case.
838
854
 
839
855
 
840
856
  return false;
@@ -918,7 +934,7 @@
918
934
  leadingWhitespace = matches && matches[0];
919
935
  }
920
936
 
921
- if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {
937
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
922
938
  // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
923
939
  dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
924
940
  }
@@ -981,7 +997,7 @@
981
997
 
982
998
 
983
999
  var _isClobbered = function _isClobbered(elm) {
984
- return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function');
1000
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
985
1001
  };
986
1002
  /**
987
1003
  * _isNode
@@ -1123,6 +1139,7 @@
1123
1139
  content = currentNode.textContent;
1124
1140
  content = stringReplace(content, MUSTACHE_EXPR$1, ' ');
1125
1141
  content = stringReplace(content, ERB_EXPR$1, ' ');
1142
+ content = stringReplace(content, TMPLIT_EXPR$1, ' ');
1126
1143
 
1127
1144
  if (currentNode.textContent !== content) {
1128
1145
  arrayPush(DOMPurify.removed, {
@@ -1271,6 +1288,7 @@
1271
1288
  if (SAFE_FOR_TEMPLATES) {
1272
1289
  value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
1273
1290
  value = stringReplace(value, ERB_EXPR$1, ' ');
1291
+ value = stringReplace(value, TMPLIT_EXPR$1, ' ');
1274
1292
  }
1275
1293
  /* Is `value` valid for this attribute? */
1276
1294
 
@@ -1566,6 +1584,7 @@
1566
1584
  if (SAFE_FOR_TEMPLATES) {
1567
1585
  serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, ' ');
1568
1586
  serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, ' ');
1587
+ serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR$1, ' ');
1569
1588
  }
1570
1589
 
1571
1590
  return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;