hoeditor-web 2.0.16 → 2.0.17
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 +107 -167
- package/lib/hoeditor.common.2.js +36 -92
- package/lib/hoeditor.common.3.js +468 -424
- package/lib/hoeditor.common.js +4700 -6924
- package/lib/hoeditor.css +1 -1
- package/lib/hoeditor.umd.1.js +107 -167
- package/lib/hoeditor.umd.2.js +36 -92
- package/lib/hoeditor.umd.3.js +468 -424
- package/lib/hoeditor.umd.js +4700 -6924
- package/lib/hoeditor.umd.min.1.js +12 -12
- package/lib/hoeditor.umd.min.2.js +2 -2
- package/lib/hoeditor.umd.min.3.js +3 -3
- package/lib/hoeditor.umd.min.js +53 -50
- 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() :
|
|
@@ -160,13 +160,13 @@
|
|
|
160
160
|
// SVG
|
|
161
161
|
var svg = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
162
162
|
|
|
163
|
-
var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', '
|
|
163
|
+
var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
|
|
164
164
|
|
|
165
165
|
// List of SVG elements that are disallowed by default.
|
|
166
166
|
// We still need to know them so that we can do namespace
|
|
167
167
|
// checks properly in case one wants to add them to
|
|
168
168
|
// allow-list.
|
|
169
|
-
var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
|
|
169
|
+
var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'feimage', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
|
|
170
170
|
|
|
171
171
|
var mathMl = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']);
|
|
172
172
|
|
|
@@ -176,9 +176,9 @@
|
|
|
176
176
|
|
|
177
177
|
var text = freeze(['#text']);
|
|
178
178
|
|
|
179
|
-
var html$1 = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', '
|
|
179
|
+
var html$1 = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
|
|
180
180
|
|
|
181
|
-
var svg$1 = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', '
|
|
181
|
+
var svg$1 = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
182
182
|
|
|
183
183
|
var mathMl$1 = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
184
184
|
|
|
@@ -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.
|
|
@@ -279,7 +279,8 @@
|
|
|
279
279
|
NodeFilter = window.NodeFilter,
|
|
280
280
|
_window$NamedNodeMap = window.NamedNodeMap,
|
|
281
281
|
NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
|
|
282
|
-
|
|
282
|
+
Text = window.Text,
|
|
283
|
+
Comment = window.Comment,
|
|
283
284
|
DOMParser = window.DOMParser,
|
|
284
285
|
trustedTypes = window.trustedTypes;
|
|
285
286
|
|
|
@@ -305,7 +306,7 @@
|
|
|
305
306
|
}
|
|
306
307
|
|
|
307
308
|
var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
|
|
308
|
-
var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
|
|
309
|
+
var emptyHTML = trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML('') : '';
|
|
309
310
|
|
|
310
311
|
var _document = document,
|
|
311
312
|
implementation = _document.implementation,
|
|
@@ -349,33 +350,6 @@
|
|
|
349
350
|
var ALLOWED_ATTR = null;
|
|
350
351
|
var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray$1(html$1), _toConsumableArray$1(svg$1), _toConsumableArray$1(mathMl$1), _toConsumableArray$1(xml)));
|
|
351
352
|
|
|
352
|
-
/*
|
|
353
|
-
* Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
|
|
354
|
-
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
|
|
355
|
-
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
|
|
356
|
-
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
|
|
357
|
-
*/
|
|
358
|
-
var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
|
|
359
|
-
tagNameCheck: {
|
|
360
|
-
writable: true,
|
|
361
|
-
configurable: false,
|
|
362
|
-
enumerable: true,
|
|
363
|
-
value: null
|
|
364
|
-
},
|
|
365
|
-
attributeNameCheck: {
|
|
366
|
-
writable: true,
|
|
367
|
-
configurable: false,
|
|
368
|
-
enumerable: true,
|
|
369
|
-
value: null
|
|
370
|
-
},
|
|
371
|
-
allowCustomizedBuiltInElements: {
|
|
372
|
-
writable: true,
|
|
373
|
-
configurable: false,
|
|
374
|
-
enumerable: true,
|
|
375
|
-
value: false
|
|
376
|
-
}
|
|
377
|
-
}));
|
|
378
|
-
|
|
379
353
|
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
|
380
354
|
var FORBID_TAGS = null;
|
|
381
355
|
|
|
@@ -416,6 +390,17 @@
|
|
|
416
390
|
* string (or a TrustedHTML object if Trusted Types are supported) */
|
|
417
391
|
var RETURN_DOM_FRAGMENT = false;
|
|
418
392
|
|
|
393
|
+
/* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM
|
|
394
|
+
* `Node` is imported into the current `Document`. If this flag is not enabled the
|
|
395
|
+
* `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by
|
|
396
|
+
* DOMPurify.
|
|
397
|
+
*
|
|
398
|
+
* This defaults to `true` starting DOMPurify 2.2.0. Note that setting it to `false`
|
|
399
|
+
* might cause XSS from attacks hidden in closed shadowroots in case the browser
|
|
400
|
+
* supports Declarative Shadow: DOM https://web.dev/declarative-shadow-dom/
|
|
401
|
+
*/
|
|
402
|
+
var RETURN_DOM_IMPORT = true;
|
|
403
|
+
|
|
419
404
|
/* Try to return a Trusted Type object instead of a string, return a string in
|
|
420
405
|
* case Trusted Types are not supported */
|
|
421
406
|
var RETURN_TRUSTED_TYPE = false;
|
|
@@ -466,10 +451,6 @@
|
|
|
466
451
|
|
|
467
452
|
var formElement = document.createElement('form');
|
|
468
453
|
|
|
469
|
-
var isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
470
|
-
return testValue instanceof RegExp || testValue instanceof Function;
|
|
471
|
-
};
|
|
472
|
-
|
|
473
454
|
/**
|
|
474
455
|
* _parseConfig
|
|
475
456
|
*
|
|
@@ -505,6 +486,7 @@
|
|
|
505
486
|
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
|
|
506
487
|
RETURN_DOM = cfg.RETURN_DOM || false; // Default false
|
|
507
488
|
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
|
|
489
|
+
RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT !== false; // Default true
|
|
508
490
|
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
|
|
509
491
|
FORCE_BODY = cfg.FORCE_BODY || false; // Default false
|
|
510
492
|
SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
|
|
@@ -512,22 +494,7 @@
|
|
|
512
494
|
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
513
495
|
IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1;
|
|
514
496
|
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
515
|
-
|
|
516
|
-
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
|
|
520
|
-
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
|
|
524
|
-
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
PARSER_MEDIA_TYPE =
|
|
528
|
-
// eslint-disable-next-line unicorn/prefer-includes
|
|
529
|
-
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;
|
|
530
|
-
|
|
497
|
+
PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE in SUPPORTED_PARSER_MEDIA_TYPES ? cfg.PARSER_MEDIA_TYPE : DEFAULT_PARSER_MEDIA_TYPE;
|
|
531
498
|
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
532
499
|
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
|
|
533
500
|
return x;
|
|
@@ -858,7 +825,15 @@
|
|
|
858
825
|
* @return {Boolean} true if clobbered, false if safe
|
|
859
826
|
*/
|
|
860
827
|
var _isClobbered = function _isClobbered(elm) {
|
|
861
|
-
|
|
828
|
+
if (elm instanceof Text || elm instanceof Comment) {
|
|
829
|
+
return false;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
if (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') {
|
|
833
|
+
return true;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
return false;
|
|
862
837
|
};
|
|
863
838
|
|
|
864
839
|
/**
|
|
@@ -954,11 +929,6 @@
|
|
|
954
929
|
}
|
|
955
930
|
}
|
|
956
931
|
|
|
957
|
-
if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
|
|
958
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
959
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
|
|
960
|
-
}
|
|
961
|
-
|
|
962
932
|
_forceRemove(currentNode);
|
|
963
933
|
return true;
|
|
964
934
|
}
|
|
@@ -1012,16 +982,8 @@
|
|
|
1012
982
|
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
1013
983
|
We don't need to check the value; it's always URI safe. */
|
|
1014
984
|
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$$1, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1018
|
-
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
1019
|
-
_basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
|
|
1020
|
-
// Alternative, second condition checks if it's an `is`-attribute, AND
|
|
1021
|
-
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1022
|
-
lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
|
|
1023
|
-
return false;
|
|
1024
|
-
}
|
|
985
|
+
return false;
|
|
986
|
+
|
|
1025
987
|
/* Check value is safe. First, is attr inert? If so, is safe */
|
|
1026
988
|
} else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$$1, stringReplace(value, ATTR_WHITESPACE$$1, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$$1, stringReplace(value, ATTR_WHITESPACE$$1, ''))) ; else if (!value) ; else {
|
|
1027
989
|
return false;
|
|
@@ -1030,16 +992,6 @@
|
|
|
1030
992
|
return true;
|
|
1031
993
|
};
|
|
1032
994
|
|
|
1033
|
-
/**
|
|
1034
|
-
* _basicCustomElementCheck
|
|
1035
|
-
* checks if at least one dash is included in tagName, and it's not the first char
|
|
1036
|
-
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
1037
|
-
* @param {string} tagName name of the tag of the node to sanitize
|
|
1038
|
-
*/
|
|
1039
|
-
var _basicCustomElementTest = function _basicCustomElementTest(tagName) {
|
|
1040
|
-
return tagName.indexOf('-') > 0;
|
|
1041
|
-
};
|
|
1042
|
-
|
|
1043
995
|
/**
|
|
1044
996
|
* _sanitizeAttributes
|
|
1045
997
|
*
|
|
@@ -1236,15 +1188,7 @@
|
|
|
1236
1188
|
IN_PLACE = false;
|
|
1237
1189
|
}
|
|
1238
1190
|
|
|
1239
|
-
if (IN_PLACE) {
|
|
1240
|
-
/* Do some early pre-sanitization to avoid unsafe root nodes */
|
|
1241
|
-
if (dirty.nodeName) {
|
|
1242
|
-
var tagName = transformCaseFunc(dirty.nodeName);
|
|
1243
|
-
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
1244
|
-
throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
} else if (dirty instanceof Node) {
|
|
1191
|
+
if (IN_PLACE) ; else if (dirty instanceof Node) {
|
|
1248
1192
|
/* If dirty is a DOM element, append to an empty document to avoid
|
|
1249
1193
|
elements being stripped by the parser */
|
|
1250
1194
|
body = _initDocument('<!---->');
|
|
@@ -1271,7 +1215,7 @@
|
|
|
1271
1215
|
|
|
1272
1216
|
/* Check we have a DOM node from the data */
|
|
1273
1217
|
if (!body) {
|
|
1274
|
-
return RETURN_DOM ? null :
|
|
1218
|
+
return RETURN_DOM ? null : emptyHTML;
|
|
1275
1219
|
}
|
|
1276
1220
|
}
|
|
1277
1221
|
|
|
@@ -1326,7 +1270,7 @@
|
|
|
1326
1270
|
returnNode = body;
|
|
1327
1271
|
}
|
|
1328
1272
|
|
|
1329
|
-
if (
|
|
1273
|
+
if (RETURN_DOM_IMPORT) {
|
|
1330
1274
|
/*
|
|
1331
1275
|
AdoptNode() is not used because internal state is not reset
|
|
1332
1276
|
(e.g. the past names map of a HTMLFormElement), this is safe
|