@ukic/web-components 3.28.0 → 3.29.0
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/components/ic-breadcrumb-group.js +16 -12
- package/components/ic-breadcrumb-group.js.map +1 -1
- package/components/ic-menu-item2.js +7 -2
- package/components/ic-menu-item2.js.map +1 -1
- package/components/ic-menu2.js +1153 -306
- package/components/ic-menu2.js.map +1 -1
- package/components/ic-pagination-item2.js.map +1 -1
- package/components/ic-pagination2.js.map +1 -1
- package/components/ic-popover-menu.js +17 -5
- package/components/ic-popover-menu.js.map +1 -1
- package/components/ic-radio-group.js.map +1 -1
- package/components/ic-switch.js.map +1 -1
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +16 -12
- package/dist/cjs/ic-breadcrumb-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js +1153 -306
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-menu-item.cjs.entry.js +5 -1
- package/dist/cjs/ic-menu-item.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-popover-menu.cjs.entry.js +16 -5
- package/dist/cjs/ic-popover-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-section-container.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ic-breadcrumb-group/ic-breadcrumb-group.js +17 -13
- package/dist/collection/components/ic-breadcrumb-group/ic-breadcrumb-group.js.map +1 -1
- package/dist/collection/components/ic-menu-item/ic-menu-item.css +9 -14
- package/dist/collection/components/ic-menu-item/ic-menu-item.js +24 -0
- package/dist/collection/components/ic-menu-item/ic-menu-item.js.map +1 -1
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.js +36 -5
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.js.map +1 -1
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.stories.js +169 -1
- package/dist/components/ic-breadcrumb-group.js +16 -12
- package/dist/components/ic-breadcrumb-group.js.map +1 -1
- package/dist/components/ic-hero.js.map +1 -1
- package/dist/components/ic-menu-item2.js +7 -2
- package/dist/components/ic-menu-item2.js.map +1 -1
- package/dist/components/ic-menu2.js +1153 -306
- package/dist/components/ic-menu2.js.map +1 -1
- package/dist/components/ic-pagination-bar.js.map +1 -1
- package/dist/components/ic-popover-menu.js +17 -5
- package/dist/components/ic-popover-menu.js.map +1 -1
- package/dist/components/ic-search-bar.js.map +1 -1
- package/dist/components/ic-side-navigation.js.map +1 -1
- package/dist/components/ic-switch.js.map +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/p-305d9639.entry.js +3 -0
- package/dist/core/p-305d9639.entry.js.map +1 -0
- package/dist/core/p-98dee727.entry.js.map +1 -1
- package/dist/core/p-a8d98164.entry.js.map +1 -1
- package/dist/core/p-be8bbed8.entry.js +2 -0
- package/dist/core/p-be8bbed8.entry.js.map +1 -0
- package/dist/core/p-ef289935.entry.js +2 -0
- package/dist/core/p-ef289935.entry.js.map +1 -0
- package/dist/core/p-f8aa89ff.entry.js +2 -0
- package/dist/core/p-f8aa89ff.entry.js.map +1 -0
- package/dist/esm/core.js +1 -1
- package/dist/esm/ic-breadcrumb-group.entry.js +16 -12
- package/dist/esm/ic-breadcrumb-group.entry.js.map +1 -1
- package/dist/esm/ic-button_3.entry.js.map +1 -1
- package/dist/esm/ic-input-component-container_3.entry.js +1153 -306
- package/dist/esm/ic-input-component-container_3.entry.js.map +1 -1
- package/dist/esm/ic-menu-item.entry.js +5 -1
- package/dist/esm/ic-menu-item.entry.js.map +1 -1
- package/dist/esm/ic-popover-menu.entry.js +16 -5
- package/dist/esm/ic-popover-menu.entry.js.map +1 -1
- package/dist/esm/ic-section-container.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ic-breadcrumb-group/ic-breadcrumb-group.d.ts +6 -1
- package/dist/types/components/ic-menu-item/ic-menu-item.d.ts +4 -0
- package/dist/types/components/ic-popover-menu/ic-popover-menu.d.ts +4 -0
- package/dist/types/components.d.ts +18 -2
- package/hydrate/index.js +1193 -325
- package/hydrate/index.mjs +1193 -325
- package/package.json +10 -6
- package/vscode-data.json +20 -1
- package/dist/core/p-2b1ce5b7.entry.js +0 -2
- package/dist/core/p-2b1ce5b7.entry.js.map +0 -1
- package/dist/core/p-56ab6fb7.entry.js +0 -2
- package/dist/core/p-56ab6fb7.entry.js.map +0 -1
- package/dist/core/p-d5fcd4f9.entry.js +0 -2
- package/dist/core/p-d5fcd4f9.entry.js.map +0 -1
- package/dist/core/p-fdc4376e.entry.js +0 -3
- package/dist/core/p-fdc4376e.entry.js.map +0 -1
package/hydrate/index.js
CHANGED
|
@@ -4958,6 +4958,8 @@ class BreadcrumbGroup {
|
|
|
4958
4958
|
this.deviceSize = DEVICE_SIZES.XL;
|
|
4959
4959
|
/**
|
|
4960
4960
|
* If `true`, display only a single breadcrumb for the parent page with a back icon.
|
|
4961
|
+
* Requires at least two `ic-breadcrumb` children, as the displayed breadcrumb
|
|
4962
|
+
* shows the title of the parent (second-to-last) page.
|
|
4961
4963
|
*/
|
|
4962
4964
|
this.backBreadcrumbOnly = false;
|
|
4963
4965
|
/**
|
|
@@ -4990,12 +4992,10 @@ class BreadcrumbGroup {
|
|
|
4990
4992
|
this.revertLastParentCollapsedBreadcrumb();
|
|
4991
4993
|
}
|
|
4992
4994
|
};
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
}
|
|
4998
|
-
};
|
|
4995
|
+
/**
|
|
4996
|
+
* Returns the second-to-last breadcrumb (the "parent" page), or `null`
|
|
4997
|
+
* if fewer than two breadcrumbs are present.
|
|
4998
|
+
*/
|
|
4999
4999
|
this.getLastParentBreadcrumb = () => {
|
|
5000
5000
|
const allBreadcrumbs = this.el.querySelectorAll(this.IC_BREADCRUMB);
|
|
5001
5001
|
return allBreadcrumbs.length > 1
|
|
@@ -5071,11 +5071,15 @@ class BreadcrumbGroup {
|
|
|
5071
5071
|
};
|
|
5072
5072
|
this.setLastParentCollapsedBackBreadcrumb = () => {
|
|
5073
5073
|
this.lastParentBreadcrumb = this.getLastParentBreadcrumb();
|
|
5074
|
-
this.
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5074
|
+
if (this.lastParentBreadcrumb === null) {
|
|
5075
|
+
console.warn("ic-breadcrumb-group: backBreadcrumbOnly requires at least two " +
|
|
5076
|
+
"ic-breadcrumb children. The back breadcrumb displays the title " +
|
|
5077
|
+
"of the parent page, so a minimum of two breadcrumbs is needed.");
|
|
5078
|
+
return;
|
|
5078
5079
|
}
|
|
5080
|
+
this.lastParentBreadcrumb.classList.add("show");
|
|
5081
|
+
this.lastParentBreadcrumb.classList.remove("hide");
|
|
5082
|
+
this.lastParentBreadcrumb.setAttribute(this.SHOW_BACK_ICON, "true");
|
|
5079
5083
|
};
|
|
5080
5084
|
this.revertLastParentCollapsedBreadcrumb = () => {
|
|
5081
5085
|
if (this.lastParentBreadcrumb) {
|
|
@@ -5158,11 +5162,11 @@ class BreadcrumbGroup {
|
|
|
5158
5162
|
}
|
|
5159
5163
|
render() {
|
|
5160
5164
|
const { backBreadcrumbOnly, collapsed, theme } = this;
|
|
5161
|
-
return (hAsync(Host, { key: '
|
|
5165
|
+
return (hAsync(Host, { key: '6f0f099c548cb049c02a6338d7cdec696e75a82c', class: {
|
|
5162
5166
|
"ic-breadcrumb-group-back": backBreadcrumbOnly,
|
|
5163
5167
|
"ic-breadcrumb-group-collapsed": collapsed,
|
|
5164
5168
|
[`ic-theme-${theme}`]: theme !== "inherit",
|
|
5165
|
-
} }, hAsync("nav", { key: '
|
|
5169
|
+
} }, hAsync("nav", { key: '86b02604932d3d54d48383f85482f2241102f8c7', "aria-label": "breadcrumbs" }, hAsync("ol", { key: 'ffe25df4eee620a28a3e427e1d65c8cdbe0e2f84' }, hAsync("slot", { key: '818515360bb8783b6151a1651eb6319f4a533242' })))));
|
|
5166
5170
|
}
|
|
5167
5171
|
get el() { return getElement(this); }
|
|
5168
5172
|
static get watchers() { return {
|
|
@@ -10628,28 +10632,69 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof win
|
|
|
10628
10632
|
|
|
10629
10633
|
var purify = {exports: {}};
|
|
10630
10634
|
|
|
10631
|
-
/*! @license DOMPurify 3.4.
|
|
10635
|
+
/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */
|
|
10632
10636
|
|
|
10633
10637
|
(function (module, exports) {
|
|
10634
10638
|
(function (global, factory) {
|
|
10635
10639
|
module.exports = factory() ;
|
|
10636
10640
|
})(commonjsGlobal, (function () {
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10641
|
+
function _arrayLikeToArray(r, a) {
|
|
10642
|
+
(null == a || a > r.length) && (a = r.length);
|
|
10643
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
10644
|
+
return n;
|
|
10645
|
+
}
|
|
10646
|
+
function _arrayWithHoles(r) {
|
|
10647
|
+
if (Array.isArray(r)) return r;
|
|
10648
|
+
}
|
|
10649
|
+
function _iterableToArrayLimit(r, l) {
|
|
10650
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
10651
|
+
if (null != t) {
|
|
10652
|
+
var e,
|
|
10653
|
+
n,
|
|
10654
|
+
i,
|
|
10655
|
+
u,
|
|
10656
|
+
a = [],
|
|
10657
|
+
f = true,
|
|
10658
|
+
o = false;
|
|
10659
|
+
try {
|
|
10660
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
10661
|
+
} catch (r) {
|
|
10662
|
+
o = true, n = r;
|
|
10663
|
+
} finally {
|
|
10664
|
+
try {
|
|
10665
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
10666
|
+
} finally {
|
|
10667
|
+
if (o) throw n;
|
|
10668
|
+
}
|
|
10669
|
+
}
|
|
10670
|
+
return a;
|
|
10671
|
+
}
|
|
10672
|
+
}
|
|
10673
|
+
function _nonIterableRest() {
|
|
10674
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10675
|
+
}
|
|
10676
|
+
function _slicedToArray(r, e) {
|
|
10677
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
10678
|
+
}
|
|
10679
|
+
function _unsupportedIterableToArray(r, a) {
|
|
10680
|
+
if (r) {
|
|
10681
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
10682
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
10683
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
10684
|
+
}
|
|
10685
|
+
}
|
|
10686
|
+
|
|
10687
|
+
const entries = Object.entries,
|
|
10688
|
+
setPrototypeOf = Object.setPrototypeOf,
|
|
10689
|
+
isFrozen = Object.isFrozen,
|
|
10690
|
+
getPrototypeOf = Object.getPrototypeOf,
|
|
10691
|
+
getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
10692
|
+
let freeze = Object.freeze,
|
|
10693
|
+
seal = Object.seal,
|
|
10694
|
+
create = Object.create; // eslint-disable-line import/no-mutable-exports
|
|
10695
|
+
let _ref = typeof Reflect !== 'undefined' && Reflect,
|
|
10696
|
+
apply = _ref.apply,
|
|
10697
|
+
construct = _ref.construct;
|
|
10653
10698
|
if (!freeze) {
|
|
10654
10699
|
freeze = function freeze(x) {
|
|
10655
10700
|
return x;
|
|
@@ -10681,13 +10726,19 @@ var purify = {exports: {}};
|
|
|
10681
10726
|
const arrayPop = unapply(Array.prototype.pop);
|
|
10682
10727
|
const arrayPush = unapply(Array.prototype.push);
|
|
10683
10728
|
const arraySplice = unapply(Array.prototype.splice);
|
|
10729
|
+
const arrayIsArray = Array.isArray;
|
|
10684
10730
|
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
10685
10731
|
const stringToString = unapply(String.prototype.toString);
|
|
10686
10732
|
const stringMatch = unapply(String.prototype.match);
|
|
10687
10733
|
const stringReplace = unapply(String.prototype.replace);
|
|
10688
10734
|
const stringIndexOf = unapply(String.prototype.indexOf);
|
|
10689
10735
|
const stringTrim = unapply(String.prototype.trim);
|
|
10736
|
+
const numberToString = unapply(Number.prototype.toString);
|
|
10737
|
+
const booleanToString = unapply(Boolean.prototype.toString);
|
|
10738
|
+
const bigintToString = typeof BigInt === 'undefined' ? null : unapply(BigInt.prototype.toString);
|
|
10739
|
+
const symbolToString = typeof Symbol === 'undefined' ? null : unapply(Symbol.prototype.toString);
|
|
10690
10740
|
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
10741
|
+
const objectToString = unapply(Object.prototype.toString);
|
|
10691
10742
|
const regExpTest = unapply(RegExp.prototype.test);
|
|
10692
10743
|
const typeErrorCreate = unconstruct(TypeError);
|
|
10693
10744
|
/**
|
|
@@ -10737,6 +10788,9 @@ var purify = {exports: {}};
|
|
|
10737
10788
|
// Prevent prototype setters from intercepting set as a this value.
|
|
10738
10789
|
setPrototypeOf(set, null);
|
|
10739
10790
|
}
|
|
10791
|
+
if (!arrayIsArray(array)) {
|
|
10792
|
+
return set;
|
|
10793
|
+
}
|
|
10740
10794
|
let l = array.length;
|
|
10741
10795
|
while (l--) {
|
|
10742
10796
|
let element = array[l];
|
|
@@ -10777,10 +10831,13 @@ var purify = {exports: {}};
|
|
|
10777
10831
|
*/
|
|
10778
10832
|
function clone(object) {
|
|
10779
10833
|
const newObject = create(null);
|
|
10780
|
-
for (const
|
|
10834
|
+
for (const _ref2 of entries(object)) {
|
|
10835
|
+
var _ref3 = _slicedToArray(_ref2, 2);
|
|
10836
|
+
const property = _ref3[0];
|
|
10837
|
+
const value = _ref3[1];
|
|
10781
10838
|
const isPropertyExist = objectHasOwnProperty(object, property);
|
|
10782
10839
|
if (isPropertyExist) {
|
|
10783
|
-
if (
|
|
10840
|
+
if (arrayIsArray(value)) {
|
|
10784
10841
|
newObject[property] = cleanArray(value);
|
|
10785
10842
|
} else if (value && typeof value === 'object' && value.constructor === Object) {
|
|
10786
10843
|
newObject[property] = clone(value);
|
|
@@ -10791,6 +10848,58 @@ var purify = {exports: {}};
|
|
|
10791
10848
|
}
|
|
10792
10849
|
return newObject;
|
|
10793
10850
|
}
|
|
10851
|
+
/**
|
|
10852
|
+
* Convert non-node values into strings without depending on direct property access.
|
|
10853
|
+
*
|
|
10854
|
+
* @param value - The value to stringify.
|
|
10855
|
+
* @returns A string representation of the provided value.
|
|
10856
|
+
*/
|
|
10857
|
+
function stringifyValue(value) {
|
|
10858
|
+
switch (typeof value) {
|
|
10859
|
+
case 'string':
|
|
10860
|
+
{
|
|
10861
|
+
return value;
|
|
10862
|
+
}
|
|
10863
|
+
case 'number':
|
|
10864
|
+
{
|
|
10865
|
+
return numberToString(value);
|
|
10866
|
+
}
|
|
10867
|
+
case 'boolean':
|
|
10868
|
+
{
|
|
10869
|
+
return booleanToString(value);
|
|
10870
|
+
}
|
|
10871
|
+
case 'bigint':
|
|
10872
|
+
{
|
|
10873
|
+
return bigintToString ? bigintToString(value) : '0';
|
|
10874
|
+
}
|
|
10875
|
+
case 'symbol':
|
|
10876
|
+
{
|
|
10877
|
+
return symbolToString ? symbolToString(value) : 'Symbol()';
|
|
10878
|
+
}
|
|
10879
|
+
case 'undefined':
|
|
10880
|
+
{
|
|
10881
|
+
return objectToString(value);
|
|
10882
|
+
}
|
|
10883
|
+
case 'function':
|
|
10884
|
+
case 'object':
|
|
10885
|
+
{
|
|
10886
|
+
if (value === null) {
|
|
10887
|
+
return objectToString(value);
|
|
10888
|
+
}
|
|
10889
|
+
const valueAsRecord = value;
|
|
10890
|
+
const valueToString = lookupGetter(valueAsRecord, 'toString');
|
|
10891
|
+
if (typeof valueToString === 'function') {
|
|
10892
|
+
const stringified = valueToString(valueAsRecord);
|
|
10893
|
+
return typeof stringified === 'string' ? stringified : objectToString(stringified);
|
|
10894
|
+
}
|
|
10895
|
+
return objectToString(value);
|
|
10896
|
+
}
|
|
10897
|
+
default:
|
|
10898
|
+
{
|
|
10899
|
+
return objectToString(value);
|
|
10900
|
+
}
|
|
10901
|
+
}
|
|
10902
|
+
}
|
|
10794
10903
|
/**
|
|
10795
10904
|
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
10796
10905
|
*
|
|
@@ -10816,6 +10925,14 @@ var purify = {exports: {}};
|
|
|
10816
10925
|
}
|
|
10817
10926
|
return fallbackValue;
|
|
10818
10927
|
}
|
|
10928
|
+
function isRegex(value) {
|
|
10929
|
+
try {
|
|
10930
|
+
regExpTest(value, '');
|
|
10931
|
+
return true;
|
|
10932
|
+
} catch (_unused) {
|
|
10933
|
+
return false;
|
|
10934
|
+
}
|
|
10935
|
+
}
|
|
10819
10936
|
|
|
10820
10937
|
const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
|
10821
10938
|
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
@@ -10831,15 +10948,14 @@ var purify = {exports: {}};
|
|
|
10831
10948
|
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
10832
10949
|
const text = freeze(['#text']);
|
|
10833
10950
|
|
|
10834
|
-
const html = 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', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns'
|
|
10951
|
+
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'command', 'commandfor', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns']);
|
|
10835
10952
|
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', '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', 'exponent', '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', 'intercept', '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', 'mask-type', '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', 'slope', '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', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', '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']);
|
|
10836
10953
|
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lquote', 'lspace', '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']);
|
|
10837
10954
|
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
10838
10955
|
|
|
10839
|
-
|
|
10840
|
-
const
|
|
10841
|
-
const
|
|
10842
|
-
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
|
|
10956
|
+
const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
|
|
10957
|
+
const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
|
|
10958
|
+
const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
|
|
10843
10959
|
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
|
|
10844
10960
|
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
10845
10961
|
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
@@ -10849,30 +10965,31 @@ var purify = {exports: {}};
|
|
|
10849
10965
|
);
|
|
10850
10966
|
const DOCTYPE_NAME = seal(/^html$/i);
|
|
10851
10967
|
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
10968
|
+
// Markup-significant character probes used by _sanitizeElements.
|
|
10969
|
+
// Shared module-level instances are safe despite the sticky /g flags:
|
|
10970
|
+
// unapply() resets lastIndex for RegExp receivers before every call.
|
|
10971
|
+
const ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
|
|
10972
|
+
const COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
|
|
10973
|
+
const FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
|
|
10974
|
+
const SELF_CLOSING_TAG = seal(/\/>/i);
|
|
10852
10975
|
|
|
10853
|
-
var EXPRESSIONS = /*#__PURE__*/Object.freeze({
|
|
10854
|
-
__proto__: null,
|
|
10855
|
-
ARIA_ATTR: ARIA_ATTR,
|
|
10856
|
-
ATTR_WHITESPACE: ATTR_WHITESPACE,
|
|
10857
|
-
CUSTOM_ELEMENT: CUSTOM_ELEMENT,
|
|
10858
|
-
DATA_ATTR: DATA_ATTR,
|
|
10859
|
-
DOCTYPE_NAME: DOCTYPE_NAME,
|
|
10860
|
-
ERB_EXPR: ERB_EXPR,
|
|
10861
|
-
IS_ALLOWED_URI: IS_ALLOWED_URI,
|
|
10862
|
-
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
|
|
10863
|
-
MUSTACHE_EXPR: MUSTACHE_EXPR,
|
|
10864
|
-
TMPLIT_EXPR: TMPLIT_EXPR
|
|
10865
|
-
});
|
|
10866
|
-
|
|
10867
|
-
/* eslint-disable @typescript-eslint/indent */
|
|
10868
10976
|
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
|
|
10869
10977
|
const NODE_TYPE = {
|
|
10870
10978
|
element: 1,
|
|
10979
|
+
attribute: 2,
|
|
10871
10980
|
text: 3,
|
|
10981
|
+
cdataSection: 4,
|
|
10982
|
+
entityReference: 5,
|
|
10872
10983
|
// Deprecated
|
|
10873
|
-
|
|
10984
|
+
entityNode: 6,
|
|
10985
|
+
// Deprecated
|
|
10986
|
+
processingInstruction: 7,
|
|
10874
10987
|
comment: 8,
|
|
10875
|
-
document: 9
|
|
10988
|
+
document: 9,
|
|
10989
|
+
documentType: 10,
|
|
10990
|
+
documentFragment: 11,
|
|
10991
|
+
notation: 12 // Deprecated
|
|
10992
|
+
};
|
|
10876
10993
|
const getGlobal = function getGlobal() {
|
|
10877
10994
|
return typeof window === 'undefined' ? null : window;
|
|
10878
10995
|
};
|
|
@@ -10927,10 +11044,25 @@ var purify = {exports: {}};
|
|
|
10927
11044
|
uponSanitizeShadowNode: []
|
|
10928
11045
|
};
|
|
10929
11046
|
};
|
|
11047
|
+
/**
|
|
11048
|
+
* Resolve a set-valued configuration option: a fresh set built from
|
|
11049
|
+
* cfg[key] when it is an own array property (seeded with a clone of
|
|
11050
|
+
* options.base when given, case-normalized via options.transform),
|
|
11051
|
+
* the fallback set otherwise.
|
|
11052
|
+
*
|
|
11053
|
+
* @param cfg the cloned, prototype-free configuration object
|
|
11054
|
+
* @param key the configuration property to read
|
|
11055
|
+
* @param fallback the set to use when the option is absent or not an array
|
|
11056
|
+
* @param options transform and optional base set to merge into
|
|
11057
|
+
* @returns the resolved set
|
|
11058
|
+
*/
|
|
11059
|
+
const _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
|
|
11060
|
+
return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
|
|
11061
|
+
};
|
|
10930
11062
|
function createDOMPurify() {
|
|
10931
11063
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
10932
11064
|
const DOMPurify = root => createDOMPurify(root);
|
|
10933
|
-
DOMPurify.version = '3.4.
|
|
11065
|
+
DOMPurify.version = '3.4.11';
|
|
10934
11066
|
DOMPurify.removed = [];
|
|
10935
11067
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
10936
11068
|
// Not running in a browser, provide a factory function
|
|
@@ -10938,28 +11070,25 @@ var purify = {exports: {}};
|
|
|
10938
11070
|
DOMPurify.isSupported = false;
|
|
10939
11071
|
return DOMPurify;
|
|
10940
11072
|
}
|
|
10941
|
-
let
|
|
10942
|
-
document
|
|
10943
|
-
} = window;
|
|
11073
|
+
let document = window.document;
|
|
10944
11074
|
const originalDocument = document;
|
|
10945
11075
|
const currentScript = originalDocument.currentScript;
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
|
|
10953
|
-
HTMLFormElement,
|
|
10954
|
-
DOMParser,
|
|
10955
|
-
trustedTypes
|
|
10956
|
-
} = window;
|
|
11076
|
+
const HTMLTemplateElement = window.HTMLTemplateElement,
|
|
11077
|
+
Node = window.Node,
|
|
11078
|
+
Element = window.Element,
|
|
11079
|
+
NodeFilter = window.NodeFilter;
|
|
11080
|
+
const DOMParser = window.DOMParser,
|
|
11081
|
+
trustedTypes = window.trustedTypes;
|
|
10957
11082
|
const ElementPrototype = Element.prototype;
|
|
10958
11083
|
const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
|
|
10959
11084
|
const remove = lookupGetter(ElementPrototype, 'remove');
|
|
10960
11085
|
const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
|
|
10961
11086
|
const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
|
|
10962
11087
|
const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
|
|
11088
|
+
const getShadowRoot = lookupGetter(ElementPrototype, 'shadowRoot');
|
|
11089
|
+
const getAttributes = lookupGetter(ElementPrototype, 'attributes');
|
|
11090
|
+
const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, 'nodeType') : null;
|
|
11091
|
+
const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, 'nodeName') : null;
|
|
10963
11092
|
// As per issue #47, the web-components registry is inherited by a
|
|
10964
11093
|
// new document created via createHTMLDocument. As per the spec
|
|
10965
11094
|
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
@@ -10974,33 +11103,74 @@ var purify = {exports: {}};
|
|
|
10974
11103
|
}
|
|
10975
11104
|
let trustedTypesPolicy;
|
|
10976
11105
|
let emptyHTML = '';
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
11106
|
+
// The instance's own internal Trusted Types policy. Unlike a caller-supplied
|
|
11107
|
+
// `TRUSTED_TYPES_POLICY`, this is created at most once — Trusted Types throws
|
|
11108
|
+
// on duplicate policy names — and is the only policy allowed to persist
|
|
11109
|
+
// across configurations and survive `clearConfig()`.
|
|
11110
|
+
let defaultTrustedTypesPolicy;
|
|
11111
|
+
let defaultTrustedTypesPolicyResolved = false;
|
|
11112
|
+
// Tracks whether we are already inside a call to the configured Trusted Types
|
|
11113
|
+
// policy (`createHTML` or `createScriptURL`). If a supplied policy callback
|
|
11114
|
+
// itself calls `DOMPurify.sanitize` (the cause of #1422), `sanitize` would
|
|
11115
|
+
// re-enter the policy and recurse until the stack overflows. We detect that
|
|
11116
|
+
// re-entry and throw a clear, actionable error instead. The guard is shared
|
|
11117
|
+
// across both callbacks, because either one re-entering `sanitize` triggers
|
|
11118
|
+
// the same unbounded recursion.
|
|
11119
|
+
let IN_TRUSTED_TYPES_POLICY = 0;
|
|
11120
|
+
const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy() {
|
|
11121
|
+
if (IN_TRUSTED_TYPES_POLICY > 0) {
|
|
11122
|
+
throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or ' + 'createScriptURL) must not call DOMPurify.sanitize, as that causes ' + 'infinite recursion. Do not pass a policy whose callbacks wrap ' + 'DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted ' + 'Types" section of the README.');
|
|
11123
|
+
}
|
|
11124
|
+
};
|
|
11125
|
+
const _createTrustedHTML = function _createTrustedHTML(html) {
|
|
11126
|
+
_assertNotInTrustedTypesPolicy();
|
|
11127
|
+
IN_TRUSTED_TYPES_POLICY++;
|
|
11128
|
+
try {
|
|
11129
|
+
return trustedTypesPolicy.createHTML(html);
|
|
11130
|
+
} finally {
|
|
11131
|
+
IN_TRUSTED_TYPES_POLICY--;
|
|
11132
|
+
}
|
|
11133
|
+
};
|
|
11134
|
+
const _createTrustedScriptURL = function _createTrustedScriptURL(scriptUrl) {
|
|
11135
|
+
_assertNotInTrustedTypesPolicy();
|
|
11136
|
+
IN_TRUSTED_TYPES_POLICY++;
|
|
11137
|
+
try {
|
|
11138
|
+
return trustedTypesPolicy.createScriptURL(scriptUrl);
|
|
11139
|
+
} finally {
|
|
11140
|
+
IN_TRUSTED_TYPES_POLICY--;
|
|
11141
|
+
}
|
|
11142
|
+
};
|
|
11143
|
+
// Lazily resolve (and cache) the instance's internal default policy.
|
|
11144
|
+
// Resolution is attempted at most once: a successful `createPolicy` cannot be
|
|
11145
|
+
// repeated (Trusted Types throws on duplicate names), and a failed or
|
|
11146
|
+
// unsupported attempt must not be retried on every parse.
|
|
11147
|
+
const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy() {
|
|
11148
|
+
if (!defaultTrustedTypesPolicyResolved) {
|
|
11149
|
+
defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
11150
|
+
defaultTrustedTypesPolicyResolved = true;
|
|
11151
|
+
}
|
|
11152
|
+
return defaultTrustedTypesPolicy;
|
|
11153
|
+
};
|
|
11154
|
+
const _document = document,
|
|
11155
|
+
implementation = _document.implementation,
|
|
11156
|
+
createNodeIterator = _document.createNodeIterator,
|
|
11157
|
+
createDocumentFragment = _document.createDocumentFragment,
|
|
11158
|
+
getElementsByTagName = _document.getElementsByTagName;
|
|
11159
|
+
const importNode = originalDocument.importNode;
|
|
10986
11160
|
let hooks = _createHooksMap();
|
|
10987
11161
|
/**
|
|
10988
11162
|
* Expose whether this browser supports running the full DOMPurify.
|
|
10989
11163
|
*/
|
|
10990
11164
|
DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
|
|
10991
|
-
const
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
} = EXPRESSIONS;
|
|
11001
|
-
let {
|
|
11002
|
-
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
11003
|
-
} = EXPRESSIONS;
|
|
11165
|
+
const MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
|
|
11166
|
+
ERB_EXPR$1 = ERB_EXPR,
|
|
11167
|
+
TMPLIT_EXPR$1 = TMPLIT_EXPR,
|
|
11168
|
+
DATA_ATTR$1 = DATA_ATTR,
|
|
11169
|
+
ARIA_ATTR$1 = ARIA_ATTR,
|
|
11170
|
+
IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
|
|
11171
|
+
ATTR_WHITESPACE$1 = ATTR_WHITESPACE,
|
|
11172
|
+
CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
|
|
11173
|
+
let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
|
|
11004
11174
|
/**
|
|
11005
11175
|
* We consider the elements and attributes below to be safe. Ideally
|
|
11006
11176
|
* don't add any new ones but feel free to remove unwanted ones.
|
|
@@ -11077,6 +11247,13 @@ var purify = {exports: {}};
|
|
|
11077
11247
|
let WHOLE_DOCUMENT = false;
|
|
11078
11248
|
/* Track whether config is already set on this instance of DOMPurify. */
|
|
11079
11249
|
let SET_CONFIG = false;
|
|
11250
|
+
/* Pristine allowlist bindings captured at setConfig() time. On the
|
|
11251
|
+
* persistent-config path sanitize() restores the sets from these before
|
|
11252
|
+
* the per-walk hook clone-guard, so a hook's in-call widening cannot
|
|
11253
|
+
* carry across calls. Null until setConfig() is called; reset by
|
|
11254
|
+
* clearConfig(). */
|
|
11255
|
+
let SET_CONFIG_ALLOWED_TAGS = null;
|
|
11256
|
+
let SET_CONFIG_ALLOWED_ATTR = null;
|
|
11080
11257
|
/* Decide if all elements (e.g. style, script) must be children of
|
|
11081
11258
|
* document.body. By default, browsers might move them to document.head */
|
|
11082
11259
|
let FORCE_BODY = false;
|
|
@@ -11119,7 +11296,17 @@ var purify = {exports: {}};
|
|
|
11119
11296
|
let USE_PROFILES = {};
|
|
11120
11297
|
/* Tags to ignore content of when KEEP_CONTENT is true */
|
|
11121
11298
|
let FORBID_CONTENTS = null;
|
|
11122
|
-
const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script',
|
|
11299
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script',
|
|
11300
|
+
// <selectedcontent> mirrors the selected <option>'s subtree, cloned by
|
|
11301
|
+
// the UA (customizable <select>) — including any on* handlers — and the
|
|
11302
|
+
// engine re-mirrors synchronously whenever a removal changes which
|
|
11303
|
+
// option/selectedcontent is current, even inside DOMPurify's inert
|
|
11304
|
+
// DOMParser document. Hoisting its children on removal re-inserts a fresh
|
|
11305
|
+
// mirror target ahead of the walk, which the engine refills, looping
|
|
11306
|
+
// forever (DoS) and amplifying output. Dropping its content on removal
|
|
11307
|
+
// (rather than hoisting) breaks that cascade; the content is a duplicate
|
|
11308
|
+
// of the option, which is sanitized on its own. See campaign-3 F1/F6.
|
|
11309
|
+
'selectedcontent', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
11123
11310
|
/* Tags that are safe for data: URIs */
|
|
11124
11311
|
let DATA_URI_TAGS = null;
|
|
11125
11312
|
const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
|
|
@@ -11135,8 +11322,10 @@ var purify = {exports: {}};
|
|
|
11135
11322
|
/* Allowed XHTML+XML namespaces */
|
|
11136
11323
|
let ALLOWED_NAMESPACES = null;
|
|
11137
11324
|
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
11138
|
-
|
|
11139
|
-
let
|
|
11325
|
+
const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze(['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
11326
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
|
|
11327
|
+
const DEFAULT_HTML_INTEGRATION_POINTS = freeze(['annotation-xml']);
|
|
11328
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
|
|
11140
11329
|
// Certain elements are allowed in both SVG and HTML
|
|
11141
11330
|
// namespace. We need to specify them explicitly
|
|
11142
11331
|
// so that they don't get erroneously deleted from
|
|
@@ -11178,15 +11367,33 @@ var purify = {exports: {}};
|
|
|
11178
11367
|
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
11179
11368
|
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
|
|
11180
11369
|
/* Set configuration parameters */
|
|
11181
|
-
ALLOWED_TAGS =
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11370
|
+
ALLOWED_TAGS = _resolveSetOption(cfg, 'ALLOWED_TAGS', DEFAULT_ALLOWED_TAGS, {
|
|
11371
|
+
transform: transformCaseFunc
|
|
11372
|
+
});
|
|
11373
|
+
ALLOWED_ATTR = _resolveSetOption(cfg, 'ALLOWED_ATTR', DEFAULT_ALLOWED_ATTR, {
|
|
11374
|
+
transform: transformCaseFunc
|
|
11375
|
+
});
|
|
11376
|
+
ALLOWED_NAMESPACES = _resolveSetOption(cfg, 'ALLOWED_NAMESPACES', DEFAULT_ALLOWED_NAMESPACES, {
|
|
11377
|
+
transform: stringToString
|
|
11378
|
+
});
|
|
11379
|
+
URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, 'ADD_URI_SAFE_ATTR', DEFAULT_URI_SAFE_ATTRIBUTES, {
|
|
11380
|
+
transform: transformCaseFunc,
|
|
11381
|
+
base: DEFAULT_URI_SAFE_ATTRIBUTES
|
|
11382
|
+
});
|
|
11383
|
+
DATA_URI_TAGS = _resolveSetOption(cfg, 'ADD_DATA_URI_TAGS', DEFAULT_DATA_URI_TAGS, {
|
|
11384
|
+
transform: transformCaseFunc,
|
|
11385
|
+
base: DEFAULT_DATA_URI_TAGS
|
|
11386
|
+
});
|
|
11387
|
+
FORBID_CONTENTS = _resolveSetOption(cfg, 'FORBID_CONTENTS', DEFAULT_FORBID_CONTENTS, {
|
|
11388
|
+
transform: transformCaseFunc
|
|
11389
|
+
});
|
|
11390
|
+
FORBID_TAGS = _resolveSetOption(cfg, 'FORBID_TAGS', clone({}), {
|
|
11391
|
+
transform: transformCaseFunc
|
|
11392
|
+
});
|
|
11393
|
+
FORBID_ATTR = _resolveSetOption(cfg, 'FORBID_ATTR', clone({}), {
|
|
11394
|
+
transform: transformCaseFunc
|
|
11395
|
+
});
|
|
11396
|
+
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === 'object' ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
|
|
11190
11397
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
11191
11398
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
11192
11399
|
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
|
|
@@ -11202,20 +11409,22 @@ var purify = {exports: {}};
|
|
|
11202
11409
|
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
|
|
11203
11410
|
KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
|
|
11204
11411
|
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
11205
|
-
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP
|
|
11206
|
-
NAMESPACE = cfg.NAMESPACE
|
|
11207
|
-
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS
|
|
11208
|
-
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11412
|
+
IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI; // Default regexp
|
|
11413
|
+
NAMESPACE = typeof cfg.NAMESPACE === 'string' ? cfg.NAMESPACE : HTML_NAMESPACE; // Default HTML namespace
|
|
11414
|
+
MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'MATHML_TEXT_INTEGRATION_POINTS') && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === 'object' ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS); // Default built-in map
|
|
11415
|
+
HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'HTML_INTEGRATION_POINTS') && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === 'object' ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS); // Default built-in map
|
|
11416
|
+
const customElementHandling = objectHasOwnProperty(cfg, 'CUSTOM_ELEMENT_HANDLING') && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === 'object' ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
|
|
11417
|
+
CUSTOM_ELEMENT_HANDLING = create(null);
|
|
11418
|
+
if (objectHasOwnProperty(customElementHandling, 'tagNameCheck') && isRegexOrFunction(customElementHandling.tagNameCheck)) {
|
|
11419
|
+
CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck; // Default undefined
|
|
11420
|
+
}
|
|
11421
|
+
if (objectHasOwnProperty(customElementHandling, 'attributeNameCheck') && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
|
|
11422
|
+
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck; // Default undefined
|
|
11423
|
+
}
|
|
11424
|
+
if (objectHasOwnProperty(customElementHandling, 'allowCustomizedBuiltInElements') && typeof customElementHandling.allowCustomizedBuiltInElements === 'boolean') {
|
|
11425
|
+
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements; // Default undefined
|
|
11426
|
+
}
|
|
11427
|
+
seal(CUSTOM_ELEMENT_HANDLING);
|
|
11219
11428
|
if (SAFE_FOR_TEMPLATES) {
|
|
11220
11429
|
ALLOW_DATA_ATTR = false;
|
|
11221
11430
|
}
|
|
@@ -11251,36 +11460,36 @@ var purify = {exports: {}};
|
|
|
11251
11460
|
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
11252
11461
|
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
11253
11462
|
/* Merge configuration parameters */
|
|
11254
|
-
if (cfg
|
|
11463
|
+
if (objectHasOwnProperty(cfg, 'ADD_TAGS')) {
|
|
11255
11464
|
if (typeof cfg.ADD_TAGS === 'function') {
|
|
11256
11465
|
EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
11257
|
-
} else {
|
|
11466
|
+
} else if (arrayIsArray(cfg.ADD_TAGS)) {
|
|
11258
11467
|
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
11259
11468
|
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
11260
11469
|
}
|
|
11261
11470
|
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
11262
11471
|
}
|
|
11263
11472
|
}
|
|
11264
|
-
if (cfg
|
|
11473
|
+
if (objectHasOwnProperty(cfg, 'ADD_ATTR')) {
|
|
11265
11474
|
if (typeof cfg.ADD_ATTR === 'function') {
|
|
11266
11475
|
EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
11267
|
-
} else {
|
|
11476
|
+
} else if (arrayIsArray(cfg.ADD_ATTR)) {
|
|
11268
11477
|
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
11269
11478
|
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
11270
11479
|
}
|
|
11271
11480
|
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
11272
11481
|
}
|
|
11273
11482
|
}
|
|
11274
|
-
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
11483
|
+
if (objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
|
|
11275
11484
|
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
11276
11485
|
}
|
|
11277
|
-
if (cfg.FORBID_CONTENTS) {
|
|
11486
|
+
if (objectHasOwnProperty(cfg, 'FORBID_CONTENTS') && arrayIsArray(cfg.FORBID_CONTENTS)) {
|
|
11278
11487
|
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
11279
11488
|
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
11280
11489
|
}
|
|
11281
11490
|
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
11282
11491
|
}
|
|
11283
|
-
if (cfg.ADD_FORBID_CONTENTS) {
|
|
11492
|
+
if (objectHasOwnProperty(cfg, 'ADD_FORBID_CONTENTS') && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
|
|
11284
11493
|
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
11285
11494
|
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
11286
11495
|
}
|
|
@@ -11299,6 +11508,13 @@ var purify = {exports: {}};
|
|
|
11299
11508
|
addToSet(ALLOWED_TAGS, ['tbody']);
|
|
11300
11509
|
delete FORBID_TAGS.tbody;
|
|
11301
11510
|
}
|
|
11511
|
+
// Re-derive the active Trusted Types policy from this configuration on
|
|
11512
|
+
// every parse. The active policy must never be sticky closure state that
|
|
11513
|
+
// outlives the config that set it: a caller-supplied policy left in place
|
|
11514
|
+
// after `clearConfig()` — or after a later call that supplied none, or
|
|
11515
|
+
// `TRUSTED_TYPES_POLICY: null` — could sign a subsequent "default"
|
|
11516
|
+
// `RETURN_TRUSTED_TYPE` result with a foreign, possibly unsafe policy.
|
|
11517
|
+
// See GHSA-vxr8-fq34-vvx9.
|
|
11302
11518
|
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
11303
11519
|
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
|
|
11304
11520
|
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
@@ -11306,18 +11522,45 @@ var purify = {exports: {}};
|
|
|
11306
11522
|
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
|
|
11307
11523
|
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
11308
11524
|
}
|
|
11309
|
-
//
|
|
11525
|
+
// A caller-supplied policy applies to this configuration only.
|
|
11526
|
+
const previousTrustedTypesPolicy = trustedTypesPolicy;
|
|
11310
11527
|
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
11311
|
-
// Sign local variables required by `sanitize`.
|
|
11312
|
-
|
|
11528
|
+
// Sign local variables required by `sanitize`. If the supplied policy's
|
|
11529
|
+
// `createHTML` is circular (i.e. it calls `DOMPurify.sanitize`), this
|
|
11530
|
+
// throws via the re-entrancy guard. Restore the previous policy first so
|
|
11531
|
+
// the instance is not left in a poisoned state. See #1422.
|
|
11532
|
+
try {
|
|
11533
|
+
emptyHTML = _createTrustedHTML('');
|
|
11534
|
+
} catch (error) {
|
|
11535
|
+
trustedTypesPolicy = previousTrustedTypesPolicy;
|
|
11536
|
+
throw error;
|
|
11537
|
+
}
|
|
11538
|
+
} else if (cfg.TRUSTED_TYPES_POLICY === null) {
|
|
11539
|
+
// Explicit opt-out for this call: perform no Trusted Types signing and
|
|
11540
|
+
// create nothing (so a strict `trusted-types` CSP that disallows a
|
|
11541
|
+
// `dompurify` policy can still call `sanitize` from inside its own
|
|
11542
|
+
// policy — see #1422). Resetting to `undefined` rather than a sticky
|
|
11543
|
+
// `null` also drops any previously retained caller policy, so it cannot
|
|
11544
|
+
// resurface on a later call, while still allowing the next config-less
|
|
11545
|
+
// call to restore the internal default policy. See GHSA-vxr8-fq34-vvx9.
|
|
11546
|
+
trustedTypesPolicy = undefined;
|
|
11547
|
+
emptyHTML = '';
|
|
11313
11548
|
} else {
|
|
11314
|
-
//
|
|
11549
|
+
// No policy supplied: keep the currently active policy if one is set — a
|
|
11550
|
+
// previously supplied policy is intentionally sticky across config-less
|
|
11551
|
+
// calls — otherwise fall back to the instance's own internal policy,
|
|
11552
|
+
// created at most once. (A policy supplied for a *single* call still
|
|
11553
|
+
// lingers by design; what must not linger is a policy whose configuration
|
|
11554
|
+
// has been torn down via `clearConfig()`, which restores the default.)
|
|
11315
11555
|
if (trustedTypesPolicy === undefined) {
|
|
11316
|
-
trustedTypesPolicy =
|
|
11556
|
+
trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
|
|
11317
11557
|
}
|
|
11318
|
-
//
|
|
11319
|
-
|
|
11320
|
-
|
|
11558
|
+
// Sign internal variables only when a policy is active. A falsy policy
|
|
11559
|
+
// (Trusted Types unsupported, creation failed, or an explicit opt-out)
|
|
11560
|
+
// leaves `emptyHTML` as a plain string, so we never call `.createHTML` on
|
|
11561
|
+
// a non-policy and throw. See #1422.
|
|
11562
|
+
if (trustedTypesPolicy && typeof emptyHTML === 'string') {
|
|
11563
|
+
emptyHTML = _createTrustedHTML('');
|
|
11321
11564
|
}
|
|
11322
11565
|
}
|
|
11323
11566
|
// Prevent further manipulation of configuration.
|
|
@@ -11332,6 +11575,77 @@ var purify = {exports: {}};
|
|
|
11332
11575
|
* correctly. */
|
|
11333
11576
|
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
11334
11577
|
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
11578
|
+
/**
|
|
11579
|
+
* Namespace rules for an element in the SVG namespace.
|
|
11580
|
+
*
|
|
11581
|
+
* @param tagName the element's lowercase tag name
|
|
11582
|
+
* @param parent the (possibly simulated) parent node
|
|
11583
|
+
* @param parentTagName the parent's lowercase tag name
|
|
11584
|
+
* @returns true if a spec-compliant parser could produce this element
|
|
11585
|
+
*/
|
|
11586
|
+
const _checkSvgNamespace = function _checkSvgNamespace(tagName, parent, parentTagName) {
|
|
11587
|
+
// The only way to switch from HTML namespace to SVG
|
|
11588
|
+
// is via <svg>. If it happens via any other tag, then
|
|
11589
|
+
// it should be killed.
|
|
11590
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
11591
|
+
return tagName === 'svg';
|
|
11592
|
+
}
|
|
11593
|
+
// The only way to switch from MathML to SVG is via <svg>
|
|
11594
|
+
// if the parent is either <annotation-xml> or a MathML
|
|
11595
|
+
// text integration point.
|
|
11596
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
11597
|
+
return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
11598
|
+
}
|
|
11599
|
+
// We only allow elements that are defined in SVG
|
|
11600
|
+
// spec. All others are disallowed in SVG namespace.
|
|
11601
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
11602
|
+
};
|
|
11603
|
+
/**
|
|
11604
|
+
* Namespace rules for an element in the MathML namespace.
|
|
11605
|
+
*
|
|
11606
|
+
* @param tagName the element's lowercase tag name
|
|
11607
|
+
* @param parent the (possibly simulated) parent node
|
|
11608
|
+
* @param parentTagName the parent's lowercase tag name
|
|
11609
|
+
* @returns true if a spec-compliant parser could produce this element
|
|
11610
|
+
*/
|
|
11611
|
+
const _checkMathMlNamespace = function _checkMathMlNamespace(tagName, parent, parentTagName) {
|
|
11612
|
+
// The only way to switch from HTML namespace to MathML
|
|
11613
|
+
// is via <math>. If it happens via any other tag, then
|
|
11614
|
+
// it should be killed.
|
|
11615
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
11616
|
+
return tagName === 'math';
|
|
11617
|
+
}
|
|
11618
|
+
// The only way to switch from SVG to MathML is via
|
|
11619
|
+
// <math> and HTML integration points
|
|
11620
|
+
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
11621
|
+
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
|
|
11622
|
+
}
|
|
11623
|
+
// We only allow elements that are defined in MathML
|
|
11624
|
+
// spec. All others are disallowed in MathML namespace.
|
|
11625
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
11626
|
+
};
|
|
11627
|
+
/**
|
|
11628
|
+
* Namespace rules for an element in the HTML namespace.
|
|
11629
|
+
*
|
|
11630
|
+
* @param tagName the element's lowercase tag name
|
|
11631
|
+
* @param parent the (possibly simulated) parent node
|
|
11632
|
+
* @param parentTagName the parent's lowercase tag name
|
|
11633
|
+
* @returns true if a spec-compliant parser could produce this element
|
|
11634
|
+
*/
|
|
11635
|
+
const _checkHtmlNamespace = function _checkHtmlNamespace(tagName, parent, parentTagName) {
|
|
11636
|
+
// The only way to switch from SVG to HTML is via
|
|
11637
|
+
// HTML integration points, and from MathML to HTML
|
|
11638
|
+
// is via MathML text integration points
|
|
11639
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
11640
|
+
return false;
|
|
11641
|
+
}
|
|
11642
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
11643
|
+
return false;
|
|
11644
|
+
}
|
|
11645
|
+
// We disallow tags that are specific for MathML
|
|
11646
|
+
// or SVG and should never appear in HTML namespace
|
|
11647
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
11648
|
+
};
|
|
11335
11649
|
/**
|
|
11336
11650
|
* @param element a DOM element whose namespace is being checked
|
|
11337
11651
|
* @returns Return false if the element has a
|
|
@@ -11354,51 +11668,13 @@ var purify = {exports: {}};
|
|
|
11354
11668
|
return false;
|
|
11355
11669
|
}
|
|
11356
11670
|
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
11357
|
-
|
|
11358
|
-
// is via <svg>. If it happens via any other tag, then
|
|
11359
|
-
// it should be killed.
|
|
11360
|
-
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
11361
|
-
return tagName === 'svg';
|
|
11362
|
-
}
|
|
11363
|
-
// The only way to switch from MathML to SVG is via`
|
|
11364
|
-
// svg if parent is either <annotation-xml> or MathML
|
|
11365
|
-
// text integration points.
|
|
11366
|
-
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
11367
|
-
return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
11368
|
-
}
|
|
11369
|
-
// We only allow elements that are defined in SVG
|
|
11370
|
-
// spec. All others are disallowed in SVG namespace.
|
|
11371
|
-
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
11671
|
+
return _checkSvgNamespace(tagName, parent, parentTagName);
|
|
11372
11672
|
}
|
|
11373
11673
|
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
11374
|
-
|
|
11375
|
-
// is via <math>. If it happens via any other tag, then
|
|
11376
|
-
// it should be killed.
|
|
11377
|
-
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
11378
|
-
return tagName === 'math';
|
|
11379
|
-
}
|
|
11380
|
-
// The only way to switch from SVG to MathML is via
|
|
11381
|
-
// <math> and HTML integration points
|
|
11382
|
-
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
11383
|
-
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
|
|
11384
|
-
}
|
|
11385
|
-
// We only allow elements that are defined in MathML
|
|
11386
|
-
// spec. All others are disallowed in MathML namespace.
|
|
11387
|
-
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
11674
|
+
return _checkMathMlNamespace(tagName, parent, parentTagName);
|
|
11388
11675
|
}
|
|
11389
11676
|
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
11390
|
-
|
|
11391
|
-
// HTML integration points, and from MathML to HTML
|
|
11392
|
-
// is via MathML text integration points
|
|
11393
|
-
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
11394
|
-
return false;
|
|
11395
|
-
}
|
|
11396
|
-
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
11397
|
-
return false;
|
|
11398
|
-
}
|
|
11399
|
-
// We disallow tags that are specific for MathML
|
|
11400
|
-
// or SVG and should never appear in HTML namespace
|
|
11401
|
-
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
11677
|
+
return _checkHtmlNamespace(tagName, parent, parentTagName);
|
|
11402
11678
|
}
|
|
11403
11679
|
// For XHTML and XML documents that support custom namespaces
|
|
11404
11680
|
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
@@ -11423,7 +11699,74 @@ var purify = {exports: {}};
|
|
|
11423
11699
|
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
|
11424
11700
|
getParentNode(node).removeChild(node);
|
|
11425
11701
|
} catch (_) {
|
|
11702
|
+
/* The normal detach failed — this is reached for a parentless node
|
|
11703
|
+
(getParentNode() is null, so .removeChild throws). Element.prototype
|
|
11704
|
+
.remove() is itself a spec no-op on a parentless node, so a recorded
|
|
11705
|
+
"removal" would otherwise hand the caller back an intact,
|
|
11706
|
+
payload-bearing node (e.g. a detached IN_PLACE root the mXSS canary or
|
|
11707
|
+
the style-with-element-child rule decided to kill). Fail closed by
|
|
11708
|
+
throwing — exactly as a clobbered root does at the IN_PLACE entry —
|
|
11709
|
+
rather than trying to "neutralize" the node via its own methods.
|
|
11710
|
+
Neutralizing would mean calling getAttributeNames()/removeAttribute()
|
|
11711
|
+
on the node, both of which a <form> root can clobber via a named child
|
|
11712
|
+
(and _isClobbered does not even probe getAttributeNames), so the
|
|
11713
|
+
neutralize step could itself be silently defeated, leaving the payload
|
|
11714
|
+
intact. A throw touches only the cached, clobber-safe remove() and
|
|
11715
|
+
getParentNode(). Generalizes GHSA-r47g-fvhr-h676 (clobbered-form root)
|
|
11716
|
+
to every root-kill reason. REPORT-3.
|
|
11717
|
+
This lives inside the catch, so it never fires for a normally-removed
|
|
11718
|
+
in-tree node: those have a parent, removeChild() succeeds, and the
|
|
11719
|
+
catch is not entered. Only a kept (parentless) root reaches here. */
|
|
11426
11720
|
remove(node);
|
|
11721
|
+
if (!getParentNode(node)) {
|
|
11722
|
+
throw typeErrorCreate('a node selected for removal could not be detached from its tree ' + 'and cannot be safely returned; refusing to sanitize in place');
|
|
11723
|
+
}
|
|
11724
|
+
}
|
|
11725
|
+
};
|
|
11726
|
+
/**
|
|
11727
|
+
* _neutralizeRoot
|
|
11728
|
+
*
|
|
11729
|
+
* Fail-closed teardown of an in-place root after the sanitize walk aborts
|
|
11730
|
+
* (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
|
|
11731
|
+
* custom element's reaction detaches a node so `_forceRemove`'s deliberate
|
|
11732
|
+
* parentless guard throws, or any other re-entrant engine mutation — would
|
|
11733
|
+
* otherwise leave the caller's *live* tree half-sanitized, with everything
|
|
11734
|
+
* after the abort point still carrying its handlers. There is no safe way
|
|
11735
|
+
* to resume the walk (the tree mutated under us), so we strip the root bare:
|
|
11736
|
+
* remove every child and every attribute, then let the caller's catch see
|
|
11737
|
+
* the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
|
|
11738
|
+
* getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
|
|
11739
|
+
*
|
|
11740
|
+
* @param root the in-place root to empty
|
|
11741
|
+
*/
|
|
11742
|
+
const _neutralizeRoot = function _neutralizeRoot(root) {
|
|
11743
|
+
const childNodes = getChildNodes(root);
|
|
11744
|
+
if (childNodes) {
|
|
11745
|
+
const snapshot = [];
|
|
11746
|
+
arrayForEach(childNodes, child => {
|
|
11747
|
+
arrayPush(snapshot, child);
|
|
11748
|
+
});
|
|
11749
|
+
arrayForEach(snapshot, child => {
|
|
11750
|
+
try {
|
|
11751
|
+
remove(child);
|
|
11752
|
+
} catch (_) {
|
|
11753
|
+
/* Best-effort teardown; a still-attached child is handled below */
|
|
11754
|
+
}
|
|
11755
|
+
});
|
|
11756
|
+
}
|
|
11757
|
+
const attributes = getAttributes(root);
|
|
11758
|
+
if (attributes) {
|
|
11759
|
+
for (let i = attributes.length - 1; i >= 0; --i) {
|
|
11760
|
+
const attribute = attributes[i];
|
|
11761
|
+
const name = attribute && attribute.name;
|
|
11762
|
+
if (typeof name === 'string') {
|
|
11763
|
+
try {
|
|
11764
|
+
root.removeAttribute(name);
|
|
11765
|
+
} catch (_) {
|
|
11766
|
+
/* Clobbered removeAttribute — ignore (fail-closed best effort) */
|
|
11767
|
+
}
|
|
11768
|
+
}
|
|
11769
|
+
}
|
|
11427
11770
|
}
|
|
11428
11771
|
};
|
|
11429
11772
|
/**
|
|
@@ -11458,6 +11801,72 @@ var purify = {exports: {}};
|
|
|
11458
11801
|
}
|
|
11459
11802
|
}
|
|
11460
11803
|
};
|
|
11804
|
+
/**
|
|
11805
|
+
* _stripDisallowedAttributes
|
|
11806
|
+
*
|
|
11807
|
+
* Removes every attribute the active configuration does not allow from a
|
|
11808
|
+
* single element, using the same allowlist as the main attribute pass (so
|
|
11809
|
+
* `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
|
|
11810
|
+
* neutralise nodes that are being discarded from an in-place tree.
|
|
11811
|
+
*
|
|
11812
|
+
* @param element the element to strip
|
|
11813
|
+
*/
|
|
11814
|
+
const _stripDisallowedAttributes = function _stripDisallowedAttributes(element) {
|
|
11815
|
+
const attributes = getAttributes(element);
|
|
11816
|
+
if (!attributes) {
|
|
11817
|
+
return;
|
|
11818
|
+
}
|
|
11819
|
+
for (let i = attributes.length - 1; i >= 0; --i) {
|
|
11820
|
+
const attribute = attributes[i];
|
|
11821
|
+
const name = attribute && attribute.name;
|
|
11822
|
+
if (typeof name !== 'string' || ALLOWED_ATTR[transformCaseFunc(name)]) {
|
|
11823
|
+
continue;
|
|
11824
|
+
}
|
|
11825
|
+
try {
|
|
11826
|
+
element.removeAttribute(name);
|
|
11827
|
+
} catch (_) {
|
|
11828
|
+
/* Clobbered removeAttribute on a doomed node — ignore */
|
|
11829
|
+
}
|
|
11830
|
+
}
|
|
11831
|
+
};
|
|
11832
|
+
/**
|
|
11833
|
+
* _neutralizeSubtree
|
|
11834
|
+
*
|
|
11835
|
+
* Completes the audit-5 F1 fix across every removal path. The KEEP_CONTENT
|
|
11836
|
+
* move-hoist neutralises only disallowed-tag removals; clobber, mXSS-canary,
|
|
11837
|
+
* namespace, comment, processing-instruction and KEEP_CONTENT:false removals
|
|
11838
|
+
* all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
|
|
11839
|
+
* those dropped nodes are detached from the caller's LIVE tree but a
|
|
11840
|
+
* handler-bearing original among them (an `<img onerror>`/`<video>` that was
|
|
11841
|
+
* loading) keeps its queued resource event, which fires in page scope after
|
|
11842
|
+
* sanitize returns. This walks a removed subtree and strips every attribute
|
|
11843
|
+
* the active configuration does not allow — so `on*` handlers are cancelled
|
|
11844
|
+
* through the SAME allowlist that governs kept nodes, not a separate `/^on/`
|
|
11845
|
+
* blocklist. Run synchronously before sanitize returns, i.e. before any
|
|
11846
|
+
* queued event can fire. Hook-free by design: these nodes leave the output,
|
|
11847
|
+
* so firing attribute hooks for them would be surprising. Clobber-safe reads;
|
|
11848
|
+
* a doomed clobbered node may shadow `removeAttribute` (its own attributes are
|
|
11849
|
+
* irrelevant — it is discarded — while its non-clobbered descendants, e.g.
|
|
11850
|
+
* the `<img>`, are reached and scrubbed).
|
|
11851
|
+
*
|
|
11852
|
+
* @param root the root of a removed subtree to neutralise
|
|
11853
|
+
*/
|
|
11854
|
+
const _neutralizeSubtree = function _neutralizeSubtree(root) {
|
|
11855
|
+
const stack = [root];
|
|
11856
|
+
while (stack.length > 0) {
|
|
11857
|
+
const node = stack.pop();
|
|
11858
|
+
const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
|
|
11859
|
+
if (nodeType === NODE_TYPE.element) {
|
|
11860
|
+
_stripDisallowedAttributes(node);
|
|
11861
|
+
}
|
|
11862
|
+
const childNodes = getChildNodes(node);
|
|
11863
|
+
if (childNodes) {
|
|
11864
|
+
for (let i = childNodes.length - 1; i >= 0; --i) {
|
|
11865
|
+
stack.push(childNodes[i]);
|
|
11866
|
+
}
|
|
11867
|
+
}
|
|
11868
|
+
}
|
|
11869
|
+
};
|
|
11461
11870
|
/**
|
|
11462
11871
|
* _initDocument
|
|
11463
11872
|
*
|
|
@@ -11479,7 +11888,7 @@ var purify = {exports: {}};
|
|
|
11479
11888
|
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
|
11480
11889
|
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
|
|
11481
11890
|
}
|
|
11482
|
-
const dirtyPayload = trustedTypesPolicy ?
|
|
11891
|
+
const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
|
|
11483
11892
|
/*
|
|
11484
11893
|
* Use the DOMParser API by default, fallback later if needs be
|
|
11485
11894
|
* DOMParser not work for svg when has multiple root element.
|
|
@@ -11519,29 +11928,254 @@ var purify = {exports: {}};
|
|
|
11519
11928
|
// eslint-disable-next-line no-bitwise
|
|
11520
11929
|
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
|
|
11521
11930
|
};
|
|
11931
|
+
/**
|
|
11932
|
+
* Replace template expression syntax (mustache, ERB, template
|
|
11933
|
+
* literal) with a space; shared by all SAFE_FOR_TEMPLATES scrub
|
|
11934
|
+
* sites. Order matters: mustache, then ERB, then template literal.
|
|
11935
|
+
*
|
|
11936
|
+
* @param value the string to scrub
|
|
11937
|
+
* @returns the scrubbed string
|
|
11938
|
+
*/
|
|
11939
|
+
const _stripTemplateExpressions = function _stripTemplateExpressions(value) {
|
|
11940
|
+
value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
|
|
11941
|
+
value = stringReplace(value, ERB_EXPR$1, ' ');
|
|
11942
|
+
value = stringReplace(value, TMPLIT_EXPR$1, ' ');
|
|
11943
|
+
return value;
|
|
11944
|
+
};
|
|
11945
|
+
/**
|
|
11946
|
+
* Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the
|
|
11947
|
+
* character data of an element subtree. Used as the final safety net for
|
|
11948
|
+
* SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions
|
|
11949
|
+
* which only form after text-node normalization (e.g. fragments split across
|
|
11950
|
+
* stripped elements) cannot survive into a template-evaluating framework.
|
|
11951
|
+
*
|
|
11952
|
+
* Walks text/comment/CDATA/processing-instruction nodes and mutates `.data`
|
|
11953
|
+
* in place rather than round-tripping through innerHTML. This preserves
|
|
11954
|
+
* descendant node references (important for IN_PLACE callers), avoids a
|
|
11955
|
+
* serialize/reparse cycle, and reads literal character data — which means
|
|
11956
|
+
* `<%...%>` in text content matches the ERB regex against its real bytes
|
|
11957
|
+
* instead of the HTML-entity-escaped form innerHTML would produce.
|
|
11958
|
+
*
|
|
11959
|
+
* Attribute values are not visited here; SAFE_FOR_TEMPLATES handling for
|
|
11960
|
+
* attributes is performed during the per-node `_sanitizeAttributes` pass.
|
|
11961
|
+
*
|
|
11962
|
+
* @param node The root element whose character data should be scrubbed.
|
|
11963
|
+
*/
|
|
11964
|
+
const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
|
|
11965
|
+
var _node$querySelectorAl;
|
|
11966
|
+
node.normalize();
|
|
11967
|
+
const walker = createNodeIterator.call(node.ownerDocument || node, node,
|
|
11968
|
+
// eslint-disable-next-line no-bitwise
|
|
11969
|
+
NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
|
|
11970
|
+
let currentNode = walker.nextNode();
|
|
11971
|
+
while (currentNode) {
|
|
11972
|
+
currentNode.data = _stripTemplateExpressions(currentNode.data);
|
|
11973
|
+
currentNode = walker.nextNode();
|
|
11974
|
+
}
|
|
11975
|
+
// NodeIterator does not descend into <template>.content per the DOM spec,
|
|
11976
|
+
// so we must explicitly recurse into each template's content fragment,
|
|
11977
|
+
// mirroring the approach used by _sanitizeShadowDOM.
|
|
11978
|
+
const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, 'template');
|
|
11979
|
+
if (templates) {
|
|
11980
|
+
arrayForEach(templates, tmpl => {
|
|
11981
|
+
if (_isDocumentFragment(tmpl.content)) {
|
|
11982
|
+
_scrubTemplateExpressions2(tmpl.content);
|
|
11983
|
+
}
|
|
11984
|
+
});
|
|
11985
|
+
}
|
|
11986
|
+
};
|
|
11522
11987
|
/**
|
|
11523
11988
|
* _isClobbered
|
|
11524
11989
|
*
|
|
11990
|
+
* Detect DOM-clobbering on HTMLFormElement nodes. Form is the only HTML
|
|
11991
|
+
* interface with [LegacyOverrideBuiltIns]; a descendant element with a
|
|
11992
|
+
* `name` attribute matching a prototype property shadows that property
|
|
11993
|
+
* on direct reads. We use this check at the IN_PLACE entry-point and
|
|
11994
|
+
* during attribute sanitization to refuse clobbered forms.
|
|
11995
|
+
*
|
|
11525
11996
|
* @param element element to check for clobbering attacks
|
|
11526
11997
|
* @return true if clobbered, false if safe
|
|
11527
11998
|
*/
|
|
11528
11999
|
const _isClobbered = function _isClobbered(element) {
|
|
11529
|
-
|
|
12000
|
+
// Realm-independent tag-name probe. If we can't determine the tag
|
|
12001
|
+
// name at all, we can't reason about clobbering — return false
|
|
12002
|
+
// (the caller's other defences still apply).
|
|
12003
|
+
const realTagName = getNodeName ? getNodeName(element) : null;
|
|
12004
|
+
if (typeof realTagName !== 'string') {
|
|
12005
|
+
return false;
|
|
12006
|
+
}
|
|
12007
|
+
if (transformCaseFunc(realTagName) !== 'form') {
|
|
12008
|
+
return false;
|
|
12009
|
+
}
|
|
12010
|
+
return typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' ||
|
|
12011
|
+
// Realm-safe NamedNodeMap detection: equality against the cached
|
|
12012
|
+
// prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
|
|
12013
|
+
// makes the direct read diverge from the cached read; a clean form
|
|
12014
|
+
// (same-realm OR foreign-realm) has both reads pointing at the same
|
|
12015
|
+
// canonical NamedNodeMap.
|
|
12016
|
+
element.attributes !== getAttributes(element) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function' ||
|
|
12017
|
+
// NodeType clobbering probe. Cached Node.prototype.nodeType getter
|
|
12018
|
+
// returns the integer 1 for any Element regardless of realm; direct
|
|
12019
|
+
// read on a clobbered form (e.g. <input name="nodeType">) returns
|
|
12020
|
+
// the named child element. Cheap addition — nodeType is read from
|
|
12021
|
+
// an internal slot, no serialization cost — and removes a residual
|
|
12022
|
+
// clobbering surface used by several mXSS / PI / comment branches
|
|
12023
|
+
// in _sanitizeElements that compare currentNode.nodeType directly.
|
|
12024
|
+
element.nodeType !== getNodeType(element) ||
|
|
12025
|
+
// HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
|
|
12026
|
+
// "childNodes" shadows the prototype getter. Direct reads of
|
|
12027
|
+
// form.childNodes from a clobbered form return the named child
|
|
12028
|
+
// instead of the real NodeList, so any walk that reads it directly
|
|
12029
|
+
// skips the form's real children. Compare the direct read to the
|
|
12030
|
+
// cached Node.prototype getter — when the form's named-property
|
|
12031
|
+
// getter intercepts the read, the two values differ and we flag
|
|
12032
|
+
// the form. This catches every clobbering child type (input,
|
|
12033
|
+
// select, etc.) regardless of whether the named child happens to
|
|
12034
|
+
// carry a numeric .length, which a typeof-based probe would miss
|
|
12035
|
+
// (e.g. HTMLSelectElement.length is a defined unsigned-long).
|
|
12036
|
+
element.childNodes !== getChildNodes(element);
|
|
12037
|
+
};
|
|
12038
|
+
/**
|
|
12039
|
+
* Checks whether the given value is a DocumentFragment from any realm.
|
|
12040
|
+
*
|
|
12041
|
+
* The realm-independent replacement reads `nodeType` through the cached
|
|
12042
|
+
* Node.prototype getter and compares to the DOCUMENT_FRAGMENT_NODE
|
|
12043
|
+
* constant (11). nodeType is a numeric value resolved from the node's
|
|
12044
|
+
* internal slot, identical across realms for the same kind of node.
|
|
12045
|
+
*
|
|
12046
|
+
* @param value object to check
|
|
12047
|
+
* @return true if value is a DocumentFragment-shaped node from any realm
|
|
12048
|
+
*/
|
|
12049
|
+
const _isDocumentFragment = function _isDocumentFragment(value) {
|
|
12050
|
+
if (!getNodeType || typeof value !== 'object' || value === null) {
|
|
12051
|
+
return false;
|
|
12052
|
+
}
|
|
12053
|
+
try {
|
|
12054
|
+
return getNodeType(value) === NODE_TYPE.documentFragment;
|
|
12055
|
+
} catch (_) {
|
|
12056
|
+
return false;
|
|
12057
|
+
}
|
|
11530
12058
|
};
|
|
11531
12059
|
/**
|
|
11532
|
-
* Checks whether the given object is a DOM node
|
|
12060
|
+
* Checks whether the given object is a DOM node, including nodes that
|
|
12061
|
+
* originate from a different window/realm (e.g. an iframe's
|
|
12062
|
+
* contentDocument). The previous `value instanceof Node` check was
|
|
12063
|
+
* realm-bound: nodes from a different window failed it, causing
|
|
12064
|
+
* sanitize() to silently stringify them and reset IN_PLACE to false,
|
|
12065
|
+
* returning the original node unsanitized. See GHSA-4w3q-35jp-p934.
|
|
11533
12066
|
*
|
|
11534
12067
|
* @param value object to check whether it's a DOM node
|
|
11535
|
-
* @return true
|
|
12068
|
+
* @return true if value is a DOM node from any realm
|
|
11536
12069
|
*/
|
|
11537
12070
|
const _isNode = function _isNode(value) {
|
|
11538
|
-
|
|
12071
|
+
if (!getNodeType || typeof value !== 'object' || value === null) {
|
|
12072
|
+
return false;
|
|
12073
|
+
}
|
|
12074
|
+
try {
|
|
12075
|
+
return typeof getNodeType(value) === 'number';
|
|
12076
|
+
} catch (_) {
|
|
12077
|
+
return false;
|
|
12078
|
+
}
|
|
11539
12079
|
};
|
|
11540
12080
|
function _executeHooks(hooks, currentNode, data) {
|
|
12081
|
+
if (hooks.length === 0) {
|
|
12082
|
+
return;
|
|
12083
|
+
}
|
|
11541
12084
|
arrayForEach(hooks, hook => {
|
|
11542
12085
|
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
11543
12086
|
});
|
|
11544
12087
|
}
|
|
12088
|
+
/**
|
|
12089
|
+
* Structural-threat checks that condemn a node regardless of the
|
|
12090
|
+
* allowlists: mXSS via namespace confusion, risky CSS construction,
|
|
12091
|
+
* processing instructions, markup-bearing comments. Pure predicate;
|
|
12092
|
+
* the caller removes. Check order is load-bearing.
|
|
12093
|
+
*
|
|
12094
|
+
* @param currentNode the node to inspect
|
|
12095
|
+
* @param tagName the node's transformCaseFunc'd tag name
|
|
12096
|
+
* @return true if the node must be removed
|
|
12097
|
+
*/
|
|
12098
|
+
const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
|
|
12099
|
+
/* Detect mXSS attempts abusing namespace confusion */
|
|
12100
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) {
|
|
12101
|
+
return true;
|
|
12102
|
+
}
|
|
12103
|
+
/* Remove risky CSS construction leading to mXSS */
|
|
12104
|
+
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === 'style' && _isNode(currentNode.firstElementChild)) {
|
|
12105
|
+
return true;
|
|
12106
|
+
}
|
|
12107
|
+
/* Remove any occurrence of processing instructions */
|
|
12108
|
+
if (currentNode.nodeType === NODE_TYPE.processingInstruction) {
|
|
12109
|
+
return true;
|
|
12110
|
+
}
|
|
12111
|
+
/* Remove any kind of possibly harmful comments */
|
|
12112
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) {
|
|
12113
|
+
return true;
|
|
12114
|
+
}
|
|
12115
|
+
return false;
|
|
12116
|
+
};
|
|
12117
|
+
/**
|
|
12118
|
+
* Handle a node whose tag is forbidden or not allowlisted: keep
|
|
12119
|
+
* allowed custom elements (false return exits _sanitizeElements
|
|
12120
|
+
* early - namespace/fallback checks and the afterSanitizeElements
|
|
12121
|
+
* hook are intentionally skipped for kept custom elements), else
|
|
12122
|
+
* hoist content per KEEP_CONTENT and remove.
|
|
12123
|
+
*
|
|
12124
|
+
* @param currentNode the disallowed node
|
|
12125
|
+
* @param tagName the node's transformCaseFunc'd tag name
|
|
12126
|
+
* @return true if the node was removed, false if kept
|
|
12127
|
+
*/
|
|
12128
|
+
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName) {
|
|
12129
|
+
/* Check if we have a custom element to handle */
|
|
12130
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
12131
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
12132
|
+
return false;
|
|
12133
|
+
}
|
|
12134
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
|
|
12135
|
+
return false;
|
|
12136
|
+
}
|
|
12137
|
+
}
|
|
12138
|
+
/* Keep content except for bad-listed elements.
|
|
12139
|
+
Use the cached prototype getters exclusively — the previous code
|
|
12140
|
+
had `|| currentNode.parentNode` / `|| currentNode.childNodes`
|
|
12141
|
+
fallbacks, but the cached getters always return the canonical
|
|
12142
|
+
value (or null for a real parent-less node), so the fallback
|
|
12143
|
+
path was dead in safe cases and a clobbering surface in unsafe
|
|
12144
|
+
ones. Falsy cached results stay falsy; the `if (childNodes &&
|
|
12145
|
+
parentNode)` check already gates correctly. */
|
|
12146
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
12147
|
+
const parentNode = getParentNode(currentNode);
|
|
12148
|
+
const childNodes = getChildNodes(currentNode);
|
|
12149
|
+
if (childNodes && parentNode) {
|
|
12150
|
+
const childCount = childNodes.length;
|
|
12151
|
+
/* In-place: hoist the *original* children so the iterator visits
|
|
12152
|
+
and sanitises them through the same allowlist pass as every other
|
|
12153
|
+
node. The caller built the tree in the live document, so the
|
|
12154
|
+
originals carry already-queued resource events (`<img onerror>`,
|
|
12155
|
+
`<video>`/`<audio>` error, lazy/`onload`, …); cloning would leave
|
|
12156
|
+
those originals detached but still armed, firing in page scope
|
|
12157
|
+
while the returned tree looked clean. Moving is safe in-place: the
|
|
12158
|
+
root is pre-validated as an allowed tag and so is never the node
|
|
12159
|
+
being removed, which keeps `parentNode` inside the iterator root
|
|
12160
|
+
and the relocated child inside the serialised tree.
|
|
12161
|
+
Otherwise (string / DOM-copy paths): clone. The iterator is rooted
|
|
12162
|
+
at — and the result serialised from — `body`, so a restrictive
|
|
12163
|
+
ALLOWED_TAGS that removes `body` itself must leave its content in
|
|
12164
|
+
place, which only cloning does; and those paths parse into an
|
|
12165
|
+
inert document, so their discarded originals never had a queued
|
|
12166
|
+
event to neutralise.
|
|
12167
|
+
`childNodes` is live; a tail-to-head walk keeps `childNodes[i]`
|
|
12168
|
+
valid whether we move (drops the trailing entry) or clone (leaves
|
|
12169
|
+
the list intact). */
|
|
12170
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
12171
|
+
const hoisted = IN_PLACE ? childNodes[i] : cloneNode(childNodes[i], true);
|
|
12172
|
+
parentNode.insertBefore(hoisted, getNextSibling(currentNode));
|
|
12173
|
+
}
|
|
12174
|
+
}
|
|
12175
|
+
}
|
|
12176
|
+
_forceRemove(currentNode);
|
|
12177
|
+
return true;
|
|
12178
|
+
};
|
|
11545
12179
|
/**
|
|
11546
12180
|
* _sanitizeElements
|
|
11547
12181
|
*
|
|
@@ -11552,7 +12186,6 @@ var purify = {exports: {}};
|
|
|
11552
12186
|
* @return true if node was killed, false if left alive
|
|
11553
12187
|
*/
|
|
11554
12188
|
const _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
11555
|
-
let content = null;
|
|
11556
12189
|
/* Execute a hook if present */
|
|
11557
12190
|
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
11558
12191
|
/* Check if element is clobbered or can clobber */
|
|
@@ -11561,76 +12194,41 @@ var purify = {exports: {}};
|
|
|
11561
12194
|
return true;
|
|
11562
12195
|
}
|
|
11563
12196
|
/* Now let's check the element's type and name */
|
|
11564
|
-
const tagName = transformCaseFunc(currentNode.nodeName);
|
|
12197
|
+
const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
|
|
11565
12198
|
/* Execute a hook if present */
|
|
11566
12199
|
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
11567
12200
|
tagName,
|
|
11568
12201
|
allowedTags: ALLOWED_TAGS
|
|
11569
12202
|
});
|
|
11570
|
-
/*
|
|
11571
|
-
if (
|
|
11572
|
-
_forceRemove(currentNode);
|
|
11573
|
-
return true;
|
|
11574
|
-
}
|
|
11575
|
-
/* Remove risky CSS construction leading to mXSS */
|
|
11576
|
-
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === 'style' && _isNode(currentNode.firstElementChild)) {
|
|
11577
|
-
_forceRemove(currentNode);
|
|
11578
|
-
return true;
|
|
11579
|
-
}
|
|
11580
|
-
/* Remove any occurrence of processing instructions */
|
|
11581
|
-
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
11582
|
-
_forceRemove(currentNode);
|
|
11583
|
-
return true;
|
|
11584
|
-
}
|
|
11585
|
-
/* Remove any kind of possibly harmful comments */
|
|
11586
|
-
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
|
12203
|
+
/* Remove mXSS vectors, processing instructions and risky comments */
|
|
12204
|
+
if (_isUnsafeNode(currentNode, tagName)) {
|
|
11587
12205
|
_forceRemove(currentNode);
|
|
11588
12206
|
return true;
|
|
11589
12207
|
}
|
|
11590
12208
|
/* Remove element if anything forbids its presence */
|
|
11591
12209
|
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
11603
|
-
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
11604
|
-
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
11605
|
-
if (childNodes && parentNode) {
|
|
11606
|
-
const childCount = childNodes.length;
|
|
11607
|
-
for (let i = childCount - 1; i >= 0; --i) {
|
|
11608
|
-
const childClone = cloneNode(childNodes[i], true);
|
|
11609
|
-
childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
|
|
11610
|
-
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
|
11611
|
-
}
|
|
11612
|
-
}
|
|
11613
|
-
}
|
|
11614
|
-
_forceRemove(currentNode);
|
|
11615
|
-
return true;
|
|
11616
|
-
}
|
|
11617
|
-
/* Check whether element has a valid namespace */
|
|
11618
|
-
if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
|
12210
|
+
return _sanitizeDisallowedNode(currentNode, tagName);
|
|
12211
|
+
}
|
|
12212
|
+
/* Check whether element has a valid namespace.
|
|
12213
|
+
Realm-safe check (GHSA-hpcv-96wg-7vj8): use the cached Node.prototype
|
|
12214
|
+
nodeType getter rather than `instanceof Element`, which is realm-
|
|
12215
|
+
bound and short-circuits to false for any node minted in a different
|
|
12216
|
+
realm — letting a foreign-realm element with a forbidden namespace
|
|
12217
|
+
slip past the namespace check entirely. */
|
|
12218
|
+
const nt = getNodeType ? getNodeType(currentNode) : currentNode.nodeType;
|
|
12219
|
+
if (nt === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
11619
12220
|
_forceRemove(currentNode);
|
|
11620
12221
|
return true;
|
|
11621
12222
|
}
|
|
11622
12223
|
/* Make sure that older browsers don't get fallback-tag mXSS */
|
|
11623
|
-
if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(
|
|
12224
|
+
if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
|
|
11624
12225
|
_forceRemove(currentNode);
|
|
11625
12226
|
return true;
|
|
11626
12227
|
}
|
|
11627
12228
|
/* Sanitize element content to be template-safe */
|
|
11628
12229
|
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
11629
12230
|
/* Get the element's text content */
|
|
11630
|
-
content = currentNode.textContent;
|
|
11631
|
-
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
11632
|
-
content = stringReplace(content, expr, ' ');
|
|
11633
|
-
});
|
|
12231
|
+
const content = _stripTemplateExpressions(currentNode.textContent);
|
|
11634
12232
|
if (currentNode.textContent !== content) {
|
|
11635
12233
|
arrayPush(DOMPurify.removed, {
|
|
11636
12234
|
element: currentNode.cloneNode()
|
|
@@ -11660,11 +12258,12 @@ var purify = {exports: {}};
|
|
|
11660
12258
|
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
11661
12259
|
return false;
|
|
11662
12260
|
}
|
|
12261
|
+
const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
|
|
11663
12262
|
/* Allow valid data-* attributes: At least one character after "-"
|
|
11664
12263
|
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
11665
12264
|
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
11666
12265
|
We don't need to check the value; it's always URI safe. */
|
|
11667
|
-
if (ALLOW_DATA_ATTR &&
|
|
12266
|
+
if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ; else if (!nameIsPermitted) {
|
|
11668
12267
|
if (
|
|
11669
12268
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
11670
12269
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
@@ -11676,11 +12275,15 @@ var purify = {exports: {}};
|
|
|
11676
12275
|
return false;
|
|
11677
12276
|
}
|
|
11678
12277
|
/* Check value is safe. First, is attr inert? If so, is safe */
|
|
11679
|
-
} else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; 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, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
|
|
12278
|
+
} 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) {
|
|
11680
12279
|
return false;
|
|
11681
12280
|
} else ;
|
|
11682
12281
|
return true;
|
|
11683
12282
|
};
|
|
12283
|
+
/* Names the HTML spec reserves from valid-custom-element-name; these must
|
|
12284
|
+
* never be treated as basic custom elements even when a permissive
|
|
12285
|
+
* CUSTOM_ELEMENT_HANDLING.tagNameCheck is configured. */
|
|
12286
|
+
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ['annotation-xml', 'color-profile', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'missing-glyph']);
|
|
11684
12287
|
/**
|
|
11685
12288
|
* _isBasicCustomElement
|
|
11686
12289
|
* checks if at least one dash is included in tagName, and it's not the first char
|
|
@@ -11690,7 +12293,64 @@ var purify = {exports: {}};
|
|
|
11690
12293
|
* @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
|
|
11691
12294
|
*/
|
|
11692
12295
|
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
11693
|
-
return tagName
|
|
12296
|
+
return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
|
|
12297
|
+
};
|
|
12298
|
+
/**
|
|
12299
|
+
* Wrap an attribute value in the matching Trusted Types object when
|
|
12300
|
+
* the active policy requires it. Namespaced attributes pass through
|
|
12301
|
+
* unchanged (no TT support yet, see
|
|
12302
|
+
* https://bugs.chromium.org/p/chromium/issues/detail?id=1305293).
|
|
12303
|
+
*
|
|
12304
|
+
* @param lcTag lowercase tag name of the containing element
|
|
12305
|
+
* @param lcName lowercase attribute name
|
|
12306
|
+
* @param namespaceURI the attribute's namespace, if any
|
|
12307
|
+
* @param value the attribute value to wrap
|
|
12308
|
+
* @return the value, wrapped when Trusted Types demand it
|
|
12309
|
+
*/
|
|
12310
|
+
const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value) {
|
|
12311
|
+
if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function' && !namespaceURI) {
|
|
12312
|
+
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
12313
|
+
case 'TrustedHTML':
|
|
12314
|
+
{
|
|
12315
|
+
return _createTrustedHTML(value);
|
|
12316
|
+
}
|
|
12317
|
+
case 'TrustedScriptURL':
|
|
12318
|
+
{
|
|
12319
|
+
return _createTrustedScriptURL(value);
|
|
12320
|
+
}
|
|
12321
|
+
}
|
|
12322
|
+
}
|
|
12323
|
+
return value;
|
|
12324
|
+
};
|
|
12325
|
+
/**
|
|
12326
|
+
* Write a modified attribute value back onto the element. On
|
|
12327
|
+
* success, re-probe for clobbering introduced by the new value and
|
|
12328
|
+
* remove the element when found; otherwise pop the removal entry
|
|
12329
|
+
* recorded by the earlier _removeAttribute (long-standing pairing
|
|
12330
|
+
* with the SANITIZE_NAMED_PROPS path - do not "fix" casually). On
|
|
12331
|
+
* failure, remove the attribute instead.
|
|
12332
|
+
*
|
|
12333
|
+
* @param currentNode the element carrying the attribute
|
|
12334
|
+
* @param name the attribute name as present on the element
|
|
12335
|
+
* @param namespaceURI the attribute's namespace, if any
|
|
12336
|
+
* @param value the new attribute value
|
|
12337
|
+
*/
|
|
12338
|
+
const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
|
|
12339
|
+
try {
|
|
12340
|
+
if (namespaceURI) {
|
|
12341
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
12342
|
+
} else {
|
|
12343
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
12344
|
+
currentNode.setAttribute(name, value);
|
|
12345
|
+
}
|
|
12346
|
+
if (_isClobbered(currentNode)) {
|
|
12347
|
+
_forceRemove(currentNode);
|
|
12348
|
+
} else {
|
|
12349
|
+
arrayPop(DOMPurify.removed);
|
|
12350
|
+
}
|
|
12351
|
+
} catch (_) {
|
|
12352
|
+
_removeAttribute(name, currentNode);
|
|
12353
|
+
}
|
|
11694
12354
|
};
|
|
11695
12355
|
/**
|
|
11696
12356
|
* _sanitizeAttributes
|
|
@@ -11705,9 +12365,7 @@ var purify = {exports: {}};
|
|
|
11705
12365
|
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
11706
12366
|
/* Execute a hook if present */
|
|
11707
12367
|
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
11708
|
-
const
|
|
11709
|
-
attributes
|
|
11710
|
-
} = currentNode;
|
|
12368
|
+
const attributes = currentNode.attributes;
|
|
11711
12369
|
/* Check if we have attributes; if not we might have a text node */
|
|
11712
12370
|
if (!attributes || _isClobbered(currentNode)) {
|
|
11713
12371
|
return;
|
|
@@ -11720,14 +12378,13 @@ var purify = {exports: {}};
|
|
|
11720
12378
|
forceKeepAttr: undefined
|
|
11721
12379
|
};
|
|
11722
12380
|
let l = attributes.length;
|
|
12381
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
11723
12382
|
/* Go backwards over all attributes; safely remove bad ones */
|
|
11724
12383
|
while (l--) {
|
|
11725
12384
|
const attr = attributes[l];
|
|
11726
|
-
const
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
value: attrValue
|
|
11730
|
-
} = attr;
|
|
12385
|
+
const name = attr.name,
|
|
12386
|
+
namespaceURI = attr.namespaceURI,
|
|
12387
|
+
attrValue = attr.value;
|
|
11731
12388
|
const lcName = transformCaseFunc(name);
|
|
11732
12389
|
const initValue = attrValue;
|
|
11733
12390
|
let value = name === 'value' ? initValue : stringTrim(initValue);
|
|
@@ -11741,12 +12398,14 @@ var purify = {exports: {}};
|
|
|
11741
12398
|
/* Full DOM Clobbering protection via namespace isolation,
|
|
11742
12399
|
* Prefix id and name attributes with `user-content-`
|
|
11743
12400
|
*/
|
|
11744
|
-
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
|
|
12401
|
+
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name') && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
|
|
11745
12402
|
// Remove the attribute with this value
|
|
11746
12403
|
_removeAttribute(name, currentNode);
|
|
11747
12404
|
// Prefix the value and later re-create the attribute with the sanitized value
|
|
11748
12405
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
11749
12406
|
}
|
|
12407
|
+
// Else: already prefixed, leave the attribute alone — the prefix is
|
|
12408
|
+
// itself the clobbering protection, and re-applying it is incorrect.
|
|
11750
12409
|
/* Work around a security issue with comments inside attributes */
|
|
11751
12410
|
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
11752
12411
|
_removeAttribute(name, currentNode);
|
|
@@ -11757,7 +12416,7 @@ var purify = {exports: {}};
|
|
|
11757
12416
|
_removeAttribute(name, currentNode);
|
|
11758
12417
|
continue;
|
|
11759
12418
|
}
|
|
11760
|
-
/* Did the hooks
|
|
12419
|
+
/* Did the hooks force-keep the attribute? */
|
|
11761
12420
|
if (hookEvent.forceKeepAttr) {
|
|
11762
12421
|
continue;
|
|
11763
12422
|
}
|
|
@@ -11767,56 +12426,24 @@ var purify = {exports: {}};
|
|
|
11767
12426
|
continue;
|
|
11768
12427
|
}
|
|
11769
12428
|
/* Work around a security issue in jQuery 3.0 */
|
|
11770
|
-
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(
|
|
12429
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
|
|
11771
12430
|
_removeAttribute(name, currentNode);
|
|
11772
12431
|
continue;
|
|
11773
12432
|
}
|
|
11774
12433
|
/* Sanitize attribute content to be template-safe */
|
|
11775
12434
|
if (SAFE_FOR_TEMPLATES) {
|
|
11776
|
-
|
|
11777
|
-
value = stringReplace(value, expr, ' ');
|
|
11778
|
-
});
|
|
12435
|
+
value = _stripTemplateExpressions(value);
|
|
11779
12436
|
}
|
|
11780
12437
|
/* Is `value` valid for this attribute? */
|
|
11781
|
-
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
11782
12438
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
11783
12439
|
_removeAttribute(name, currentNode);
|
|
11784
12440
|
continue;
|
|
11785
12441
|
}
|
|
11786
12442
|
/* Handle attributes that require Trusted Types */
|
|
11787
|
-
|
|
11788
|
-
if (namespaceURI) ; else {
|
|
11789
|
-
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
11790
|
-
case 'TrustedHTML':
|
|
11791
|
-
{
|
|
11792
|
-
value = trustedTypesPolicy.createHTML(value);
|
|
11793
|
-
break;
|
|
11794
|
-
}
|
|
11795
|
-
case 'TrustedScriptURL':
|
|
11796
|
-
{
|
|
11797
|
-
value = trustedTypesPolicy.createScriptURL(value);
|
|
11798
|
-
break;
|
|
11799
|
-
}
|
|
11800
|
-
}
|
|
11801
|
-
}
|
|
11802
|
-
}
|
|
12443
|
+
value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
|
|
11803
12444
|
/* Handle invalid data-* attribute set by try-catching it */
|
|
11804
12445
|
if (value !== initValue) {
|
|
11805
|
-
|
|
11806
|
-
if (namespaceURI) {
|
|
11807
|
-
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
11808
|
-
} else {
|
|
11809
|
-
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
11810
|
-
currentNode.setAttribute(name, value);
|
|
11811
|
-
}
|
|
11812
|
-
if (_isClobbered(currentNode)) {
|
|
11813
|
-
_forceRemove(currentNode);
|
|
11814
|
-
} else {
|
|
11815
|
-
arrayPop(DOMPurify.removed);
|
|
11816
|
-
}
|
|
11817
|
-
} catch (_) {
|
|
11818
|
-
_removeAttribute(name, currentNode);
|
|
11819
|
-
}
|
|
12446
|
+
_setAttributeValue(currentNode, name, namespaceURI, value);
|
|
11820
12447
|
}
|
|
11821
12448
|
}
|
|
11822
12449
|
/* Execute a hook if present */
|
|
@@ -11839,14 +12466,133 @@ var purify = {exports: {}};
|
|
|
11839
12466
|
_sanitizeElements(shadowNode);
|
|
11840
12467
|
/* Check attributes next */
|
|
11841
12468
|
_sanitizeAttributes(shadowNode);
|
|
11842
|
-
/* Deep shadow DOM detected
|
|
11843
|
-
|
|
12469
|
+
/* Deep shadow DOM detected.
|
|
12470
|
+
Realm-safe check (GHSA-hpcv-96wg-7vj8): use nodeType against the
|
|
12471
|
+
DOCUMENT_FRAGMENT_NODE constant rather than instanceof, so we
|
|
12472
|
+
recurse into <template>.content from foreign realms too. */
|
|
12473
|
+
if (_isDocumentFragment(shadowNode.content)) {
|
|
11844
12474
|
_sanitizeShadowDOM2(shadowNode.content);
|
|
11845
12475
|
}
|
|
12476
|
+
/* An element iterated here may itself host an attached
|
|
12477
|
+
shadow root. The default NodeIterator does not enter shadow
|
|
12478
|
+
trees, so a shadow root nested inside template.content was
|
|
12479
|
+
previously reached by no walk at all (the pre-pass at
|
|
12480
|
+
_sanitizeAttachedShadowRoots descends via childNodes, which
|
|
12481
|
+
doesn't enter template.content; the template-content recursion
|
|
12482
|
+
above iterates the content but never inspected shadowRoot).
|
|
12483
|
+
Walk it explicitly. The nodeType guard avoids reading
|
|
12484
|
+
shadowRoot off text / comment / CDATA / PI nodes that the
|
|
12485
|
+
iterator also surfaces. */
|
|
12486
|
+
const shadowNodeType = getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType;
|
|
12487
|
+
if (shadowNodeType === NODE_TYPE.element) {
|
|
12488
|
+
const innerSr = getShadowRoot(shadowNode);
|
|
12489
|
+
if (_isDocumentFragment(innerSr)) {
|
|
12490
|
+
_sanitizeAttachedShadowRoots(innerSr);
|
|
12491
|
+
_sanitizeShadowDOM2(innerSr);
|
|
12492
|
+
}
|
|
12493
|
+
}
|
|
11846
12494
|
}
|
|
11847
12495
|
/* Execute a hook if present */
|
|
11848
12496
|
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
11849
12497
|
};
|
|
12498
|
+
/**
|
|
12499
|
+
* _sanitizeAttachedShadowRoots
|
|
12500
|
+
*
|
|
12501
|
+
* Walks `root` and feeds every attached shadow root we encounter into
|
|
12502
|
+
* the existing _sanitizeShadowDOM pipeline. The default node iterator
|
|
12503
|
+
* does not descend into shadow trees, so nodes inside an attached
|
|
12504
|
+
* shadow root would otherwise be skipped entirely.
|
|
12505
|
+
*
|
|
12506
|
+
* Two real input paths put attached shadow roots in front of us:
|
|
12507
|
+
* 1. IN_PLACE on a DOM node that already has shadow roots attached.
|
|
12508
|
+
* 2. DOM-node input where importNode(dirty, true) deep-clones the
|
|
12509
|
+
* shadow root because it was created with `clonable: true`.
|
|
12510
|
+
*
|
|
12511
|
+
* This pass runs once, up front, so the main iteration loop (and the
|
|
12512
|
+
* existing _sanitizeShadowDOM template-content recursion) stay
|
|
12513
|
+
* untouched — string-input paths are not affected.
|
|
12514
|
+
*
|
|
12515
|
+
* @param root the subtree root to walk for attached shadow roots
|
|
12516
|
+
*/
|
|
12517
|
+
const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots(root) {
|
|
12518
|
+
/* Iterative (explicit stack) rather than per-child recursion. DOM APIs
|
|
12519
|
+
impose no depth cap, so an attacker-shaped tree (JSON/CRDT/editor data
|
|
12520
|
+
built straight into the DOM — the IN_PLACE surface) deeper than the JS
|
|
12521
|
+
call-stack budget would otherwise overflow native recursion here and
|
|
12522
|
+
throw at the IN_PLACE entry pre-pass, before a single node is
|
|
12523
|
+
sanitized, leaving the caller's live tree untouched (fail-open). See
|
|
12524
|
+
campaign-3 F4. A heap stack keeps depth off the call stack.
|
|
12525
|
+
Each work item is either a node to descend into, or a deferred
|
|
12526
|
+
`_sanitizeShadowDOM` for an already-walked shadow root. The deferred
|
|
12527
|
+
form preserves the original post-order discipline: a shadow root's
|
|
12528
|
+
nested shadow roots are discovered before the outer shadow is
|
|
12529
|
+
sanitized (which may remove hosts). Pushes are in reverse of the
|
|
12530
|
+
desired processing order (LIFO): template content, then children, then
|
|
12531
|
+
the shadow-sanitize, then the shadow walk — so the order matches the
|
|
12532
|
+
previous recursion exactly. */
|
|
12533
|
+
const stack = [{
|
|
12534
|
+
node: root,
|
|
12535
|
+
shadow: null
|
|
12536
|
+
}];
|
|
12537
|
+
while (stack.length > 0) {
|
|
12538
|
+
const item = stack.pop();
|
|
12539
|
+
/* Deferred shadow-DOM sanitisation: runs after its subtree was walked. */
|
|
12540
|
+
if (item.shadow) {
|
|
12541
|
+
_sanitizeShadowDOM2(item.shadow);
|
|
12542
|
+
continue;
|
|
12543
|
+
}
|
|
12544
|
+
const node = item.node;
|
|
12545
|
+
const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
|
|
12546
|
+
const isElement = nodeType === NODE_TYPE.element;
|
|
12547
|
+
/* (pushed last → processed first) Children, snapshotted in reverse so
|
|
12548
|
+
the first child is processed first. Snapshotting matters because a
|
|
12549
|
+
hook may detach siblings mid-walk. */
|
|
12550
|
+
const childNodes = getChildNodes(node);
|
|
12551
|
+
if (childNodes) {
|
|
12552
|
+
for (let i = childNodes.length - 1; i >= 0; --i) {
|
|
12553
|
+
stack.push({
|
|
12554
|
+
node: childNodes[i],
|
|
12555
|
+
shadow: null
|
|
12556
|
+
});
|
|
12557
|
+
}
|
|
12558
|
+
}
|
|
12559
|
+
/* (pushed before children → processed after them, matching the old
|
|
12560
|
+
"template content last" order) When the node is a <template>,
|
|
12561
|
+
descend into its content. */
|
|
12562
|
+
if (isElement) {
|
|
12563
|
+
const rootName = getNodeName ? getNodeName(node) : null;
|
|
12564
|
+
if (typeof rootName === 'string' && transformCaseFunc(rootName) === 'template') {
|
|
12565
|
+
const content = node.content;
|
|
12566
|
+
if (_isDocumentFragment(content)) {
|
|
12567
|
+
stack.push({
|
|
12568
|
+
node: content,
|
|
12569
|
+
shadow: null
|
|
12570
|
+
});
|
|
12571
|
+
}
|
|
12572
|
+
}
|
|
12573
|
+
}
|
|
12574
|
+
/* Shadow root (processed first): walk its subtree, then sanitise it.
|
|
12575
|
+
Realm-safe check (GHSA-hpcv-96wg-7vj8): nodeType-based detection
|
|
12576
|
+
rather than `instanceof DocumentFragment`, which is realm-bound and
|
|
12577
|
+
silently skipped foreign-realm shadow roots (e.g.
|
|
12578
|
+
iframe.contentDocument attachShadow). */
|
|
12579
|
+
if (isElement) {
|
|
12580
|
+
const sr = getShadowRoot(node);
|
|
12581
|
+
if (_isDocumentFragment(sr)) {
|
|
12582
|
+
/* Push the deferred sanitise first so it pops after the shadow
|
|
12583
|
+
walk we push next, i.e. nested shadow roots are discovered
|
|
12584
|
+
before this one is sanitised. */
|
|
12585
|
+
stack.push({
|
|
12586
|
+
node: null,
|
|
12587
|
+
shadow: sr
|
|
12588
|
+
}, {
|
|
12589
|
+
node: sr,
|
|
12590
|
+
shadow: null
|
|
12591
|
+
});
|
|
12592
|
+
}
|
|
12593
|
+
}
|
|
12594
|
+
}
|
|
12595
|
+
};
|
|
11850
12596
|
// eslint-disable-next-line complexity
|
|
11851
12597
|
DOMPurify.sanitize = function (dirty) {
|
|
11852
12598
|
let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -11863,13 +12609,9 @@ var purify = {exports: {}};
|
|
|
11863
12609
|
}
|
|
11864
12610
|
/* Stringify, in case dirty is an object */
|
|
11865
12611
|
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
throw typeErrorCreate('dirty is not a string, aborting');
|
|
11870
|
-
}
|
|
11871
|
-
} else {
|
|
11872
|
-
throw typeErrorCreate('toString is not a function');
|
|
12612
|
+
dirty = stringifyValue(dirty);
|
|
12613
|
+
if (typeof dirty !== 'string') {
|
|
12614
|
+
throw typeErrorCreate('dirty is not a string, aborting');
|
|
11873
12615
|
}
|
|
11874
12616
|
}
|
|
11875
12617
|
/* Return dirty HTML if DOMPurify cannot run */
|
|
@@ -11877,24 +12619,78 @@ var purify = {exports: {}};
|
|
|
11877
12619
|
return dirty;
|
|
11878
12620
|
}
|
|
11879
12621
|
/* Assign config vars */
|
|
11880
|
-
if (
|
|
12622
|
+
if (SET_CONFIG) {
|
|
12623
|
+
/* Persistent setConfig() path: _parseConfig is skipped, so the sets are
|
|
12624
|
+
* not re-derived per call. Restore them from the pristine bindings
|
|
12625
|
+
* captured at setConfig() time so a previous call's hook clone (mutated
|
|
12626
|
+
* below) does not carry over. */
|
|
12627
|
+
ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
|
|
12628
|
+
ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
|
|
12629
|
+
} else {
|
|
11881
12630
|
_parseConfig(cfg);
|
|
11882
12631
|
}
|
|
12632
|
+
/* Clone the hook-mutable allowlists before the walk whenever an
|
|
12633
|
+
* uponSanitize* hook is registered. The hook event exposes ALLOWED_TAGS
|
|
12634
|
+
* and ALLOWED_ATTR by reference (as allowedTags / allowedAttributes), so
|
|
12635
|
+
* a hook that widens them would otherwise mutate the shared set
|
|
12636
|
+
* permanently: across later calls and across every element. Cloning per
|
|
12637
|
+
* walk keeps documented in-call widening working while scoping it to the
|
|
12638
|
+
* call. A single guard for both config paths - the per-call path rebinds
|
|
12639
|
+
* the sets in _parseConfig each call, the persistent path restores them
|
|
12640
|
+
* from the captured bindings just above - so the two cannot diverge. */
|
|
12641
|
+
if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) {
|
|
12642
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
12643
|
+
}
|
|
12644
|
+
if (hooks.uponSanitizeAttribute.length > 0) {
|
|
12645
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
12646
|
+
}
|
|
11883
12647
|
/* Clean up removed elements */
|
|
11884
12648
|
DOMPurify.removed = [];
|
|
11885
|
-
/*
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
|
|
12649
|
+
/* Resolve IN_PLACE for this call without mutating persistent config.
|
|
12650
|
+
Writing the IN_PLACE closure variable here leaks under setConfig(),
|
|
12651
|
+
where _parseConfig is skipped on later calls: a single string call would
|
|
12652
|
+
disable in-place mode for every subsequent node call, returning a
|
|
12653
|
+
sanitized copy while leaving the caller's node — which in-place callers
|
|
12654
|
+
keep using and whose return value they ignore — unsanitized. REPORT-2. */
|
|
12655
|
+
const inPlace = IN_PLACE && typeof dirty !== 'string' && _isNode(dirty);
|
|
12656
|
+
if (inPlace) {
|
|
12657
|
+
/* Do some early pre-sanitization to avoid unsafe root nodes.
|
|
12658
|
+
Read nodeName through the cached prototype getter — a clobbering
|
|
12659
|
+
child named "nodeName" on the form root would otherwise shadow
|
|
12660
|
+
the property and let this check skip the root-allowlist
|
|
12661
|
+
validation entirely. */
|
|
12662
|
+
const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
|
|
12663
|
+
if (typeof nn === 'string') {
|
|
12664
|
+
const tagName = transformCaseFunc(nn);
|
|
11893
12665
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
11894
12666
|
throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
|
|
11895
12667
|
}
|
|
11896
12668
|
}
|
|
11897
|
-
|
|
12669
|
+
/* Pre-flight the root through _isClobbered. The iterator-driven
|
|
12670
|
+
removal path can not detach a parent-less root: _forceRemove
|
|
12671
|
+
falls through to Element.prototype.remove(), which per spec
|
|
12672
|
+
is a no-op on a node with no parent. A clobbered root would
|
|
12673
|
+
then survive the main loop with its attributes uninspected,
|
|
12674
|
+
because _sanitizeAttributes early-returns on _isClobbered. The
|
|
12675
|
+
result would be an attacker-controlled form, complete with any
|
|
12676
|
+
event-handler attributes the caller passed in, handed back to
|
|
12677
|
+
the application unsanitized. Refuse to sanitize such a root
|
|
12678
|
+
the same way we refuse a forbidden tag. GHSA-r47g-fvhr-h676. */
|
|
12679
|
+
if (_isClobbered(dirty)) {
|
|
12680
|
+
throw typeErrorCreate('root node is clobbered and cannot be sanitized in-place');
|
|
12681
|
+
}
|
|
12682
|
+
/* Sanitize attached shadow roots before the main iterator runs.
|
|
12683
|
+
The iterator does not descend into shadow trees. Same fail-closed
|
|
12684
|
+
barrier as the main walk (campaign-3 F2): a custom-element reaction
|
|
12685
|
+
inside a shadow root could abort this pre-pass before the walk runs,
|
|
12686
|
+
which would otherwise leave the entire live tree unsanitized. */
|
|
12687
|
+
try {
|
|
12688
|
+
_sanitizeAttachedShadowRoots(dirty);
|
|
12689
|
+
} catch (error) {
|
|
12690
|
+
_neutralizeRoot(dirty);
|
|
12691
|
+
throw error;
|
|
12692
|
+
}
|
|
12693
|
+
} else if (_isNode(dirty)) {
|
|
11898
12694
|
/* If dirty is a DOM element, append to an empty document to avoid
|
|
11899
12695
|
elements being stripped by the parser */
|
|
11900
12696
|
body = _initDocument('<!---->');
|
|
@@ -11908,12 +12704,18 @@ var purify = {exports: {}};
|
|
|
11908
12704
|
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
11909
12705
|
body.appendChild(importedNode);
|
|
11910
12706
|
}
|
|
12707
|
+
/* Clonable shadow roots are deep-cloned by importNode(); sanitize
|
|
12708
|
+
them before the main iterator runs, since the iterator does not
|
|
12709
|
+
descend into shadow trees. The walk routes every read through a
|
|
12710
|
+
cached prototype getter so clobbering descendants on a form root
|
|
12711
|
+
cannot hide a shadow host from this pass. */
|
|
12712
|
+
_sanitizeAttachedShadowRoots(importedNode);
|
|
11911
12713
|
} else {
|
|
11912
12714
|
/* Exit directly if we have nothing to do */
|
|
11913
12715
|
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
|
|
11914
12716
|
// eslint-disable-next-line unicorn/prefer-includes
|
|
11915
12717
|
dirty.indexOf('<') === -1) {
|
|
11916
|
-
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ?
|
|
12718
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
|
|
11917
12719
|
}
|
|
11918
12720
|
/* Initialize the document to work on */
|
|
11919
12721
|
body = _initDocument(dirty);
|
|
@@ -11927,31 +12729,59 @@ var purify = {exports: {}};
|
|
|
11927
12729
|
_forceRemove(body.firstChild);
|
|
11928
12730
|
}
|
|
11929
12731
|
/* Get node iterator */
|
|
11930
|
-
const nodeIterator = _createNodeIterator(
|
|
11931
|
-
/* Now start iterating over the created document
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
12732
|
+
const nodeIterator = _createNodeIterator(inPlace ? dirty : body);
|
|
12733
|
+
/* Now start iterating over the created document.
|
|
12734
|
+
The walk runs inside an exception barrier (campaign-3 F2): a re-entrant
|
|
12735
|
+
engine/custom-element mutation can detach a node mid-walk so
|
|
12736
|
+
`_forceRemove`'s parentless guard throws, aborting the loop. Without the
|
|
12737
|
+
barrier the caller's in-place tree would be left half-sanitized with the
|
|
12738
|
+
unvisited tail still armed. On any throw we fail closed — strip the
|
|
12739
|
+
in-place root bare — then rethrow so the existing throw contract is
|
|
12740
|
+
preserved. (String/DOM-copy paths never return the partial body, so the
|
|
12741
|
+
propagating throw is already fail-closed there.) */
|
|
12742
|
+
try {
|
|
12743
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
12744
|
+
/* Sanitize tags and elements */
|
|
12745
|
+
_sanitizeElements(currentNode);
|
|
12746
|
+
/* Check attributes next */
|
|
12747
|
+
_sanitizeAttributes(currentNode);
|
|
12748
|
+
/* Shadow DOM detected, sanitize it.
|
|
12749
|
+
Realm-safe check (GHSA-hpcv-96wg-7vj8): nodeType-based detection
|
|
12750
|
+
instead of instanceof, so foreign-realm <template>.content is
|
|
12751
|
+
walked correctly. */
|
|
12752
|
+
if (_isDocumentFragment(currentNode.content)) {
|
|
12753
|
+
_sanitizeShadowDOM2(currentNode.content);
|
|
12754
|
+
}
|
|
12755
|
+
}
|
|
12756
|
+
} catch (error) {
|
|
12757
|
+
if (inPlace) {
|
|
12758
|
+
_neutralizeRoot(dirty);
|
|
11940
12759
|
}
|
|
12760
|
+
throw error;
|
|
11941
12761
|
}
|
|
11942
12762
|
/* If we sanitized `dirty` in-place, return it. */
|
|
11943
|
-
if (
|
|
12763
|
+
if (inPlace) {
|
|
12764
|
+
/* Fail-closed completion of the audit-5 F1 fix: every node removed from
|
|
12765
|
+
the caller's live tree is detached but may still hold a queued
|
|
12766
|
+
resource-event handler that fires in page scope after we return. The
|
|
12767
|
+
move-hoist covers only disallowed-tag KEEP_CONTENT removals; strip the
|
|
12768
|
+
non-allow-listed attributes off every other removed subtree (clobber,
|
|
12769
|
+
mXSS, namespace, comments, KEEP_CONTENT:false, …) so those handlers are
|
|
12770
|
+
cancelled before any event can fire. Runs synchronously, pre-return. */
|
|
12771
|
+
arrayForEach(DOMPurify.removed, entry => {
|
|
12772
|
+
if (entry.element) {
|
|
12773
|
+
_neutralizeSubtree(entry.element);
|
|
12774
|
+
}
|
|
12775
|
+
});
|
|
12776
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
12777
|
+
_scrubTemplateExpressions2(dirty);
|
|
12778
|
+
}
|
|
11944
12779
|
return dirty;
|
|
11945
12780
|
}
|
|
11946
12781
|
/* Return sanitized string or DOM */
|
|
11947
12782
|
if (RETURN_DOM) {
|
|
11948
12783
|
if (SAFE_FOR_TEMPLATES) {
|
|
11949
|
-
body
|
|
11950
|
-
let html = body.innerHTML;
|
|
11951
|
-
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
11952
|
-
html = stringReplace(html, expr, ' ');
|
|
11953
|
-
});
|
|
11954
|
-
body.innerHTML = html;
|
|
12784
|
+
_scrubTemplateExpressions2(body);
|
|
11955
12785
|
}
|
|
11956
12786
|
if (RETURN_DOM_FRAGMENT) {
|
|
11957
12787
|
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
@@ -11981,20 +12811,28 @@ var purify = {exports: {}};
|
|
|
11981
12811
|
}
|
|
11982
12812
|
/* Sanitize final string template-safe */
|
|
11983
12813
|
if (SAFE_FOR_TEMPLATES) {
|
|
11984
|
-
|
|
11985
|
-
serializedHTML = stringReplace(serializedHTML, expr, ' ');
|
|
11986
|
-
});
|
|
12814
|
+
serializedHTML = _stripTemplateExpressions(serializedHTML);
|
|
11987
12815
|
}
|
|
11988
|
-
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ?
|
|
12816
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
|
|
11989
12817
|
};
|
|
11990
12818
|
DOMPurify.setConfig = function () {
|
|
11991
12819
|
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11992
12820
|
_parseConfig(cfg);
|
|
11993
12821
|
SET_CONFIG = true;
|
|
12822
|
+
SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
|
|
12823
|
+
SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
|
|
11994
12824
|
};
|
|
11995
12825
|
DOMPurify.clearConfig = function () {
|
|
11996
12826
|
CONFIG = null;
|
|
11997
12827
|
SET_CONFIG = false;
|
|
12828
|
+
SET_CONFIG_ALLOWED_TAGS = null;
|
|
12829
|
+
SET_CONFIG_ALLOWED_ATTR = null;
|
|
12830
|
+
// Drop any caller-supplied Trusted Types policy so it cannot poison later
|
|
12831
|
+
// `RETURN_TRUSTED_TYPE` output. The internal default policy (cached, and
|
|
12832
|
+
// never recreated — Trusted Types throws on duplicate names) is restored by
|
|
12833
|
+
// the next `_parseConfig`. See GHSA-vxr8-fq34-vvx9.
|
|
12834
|
+
trustedTypesPolicy = defaultTrustedTypesPolicy;
|
|
12835
|
+
emptyHTML = '';
|
|
11998
12836
|
};
|
|
11999
12837
|
DOMPurify.isValidAttribute = function (tag, attr, value) {
|
|
12000
12838
|
/* Initialize shared config vars if necessary. */
|
|
@@ -12009,9 +12847,19 @@ var purify = {exports: {}};
|
|
|
12009
12847
|
if (typeof hookFunction !== 'function') {
|
|
12010
12848
|
return;
|
|
12011
12849
|
}
|
|
12850
|
+
/* Reject unknown entry points. Without this, a non-hook key (e.g.
|
|
12851
|
+
* '__proto__') indexes off the prototype chain rather than a real
|
|
12852
|
+
* hook array, and arrayPush then writes to Object.prototype. Guard
|
|
12853
|
+
* with an own-property check against the known hook names. */
|
|
12854
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) {
|
|
12855
|
+
return;
|
|
12856
|
+
}
|
|
12012
12857
|
arrayPush(hooks[entryPoint], hookFunction);
|
|
12013
12858
|
};
|
|
12014
12859
|
DOMPurify.removeHook = function (entryPoint, hookFunction) {
|
|
12860
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) {
|
|
12861
|
+
return undefined;
|
|
12862
|
+
}
|
|
12015
12863
|
if (hookFunction !== undefined) {
|
|
12016
12864
|
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
12017
12865
|
return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
@@ -12019,6 +12867,9 @@ var purify = {exports: {}};
|
|
|
12019
12867
|
return arrayPop(hooks[entryPoint]);
|
|
12020
12868
|
};
|
|
12021
12869
|
DOMPurify.removeHooks = function (entryPoint) {
|
|
12870
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) {
|
|
12871
|
+
return;
|
|
12872
|
+
}
|
|
12022
12873
|
hooks[entryPoint] = [];
|
|
12023
12874
|
};
|
|
12024
12875
|
DOMPurify.removeAllHooks = function () {
|
|
@@ -13198,7 +14049,7 @@ class MenuGroup {
|
|
|
13198
14049
|
}; }
|
|
13199
14050
|
}
|
|
13200
14051
|
|
|
13201
|
-
const icMenuItemCss = "/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=\"button\"],[type=\"reset\"],[type=\"submit\"]{-webkit-appearance:button}button::-moz-focus-inner,[type=\"button\"]::-moz-focus-inner,[type=\"reset\"]::-moz-focus-inner,[type=\"submit\"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=\"button\"]:-moz-focusring,[type=\"reset\"]:-moz-focusring,[type=\"submit\"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=\"checkbox\"],[type=\"radio\"]{box-sizing:border-box;padding:0;}[type=\"number\"]::-webkit-inner-spin-button,[type=\"number\"]::-webkit-outer-spin-button{height:auto}[type=\"search\"]{-webkit-appearance:textfield;outline-offset:-2px;}[type=\"search\"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font-style:inherit;vertical-align:baseline}:host ::part(button){color:var(--ic-popover-menu-item-check);--ic-typography-color:var(--ic-popover-menu-item-check);padding:calc(var(--ic-space-xxxs) / 2);display:flex;align-items:flex-start;gap:var(--ic-space-xs);border-radius:0;min-height:2.5rem;height:auto}.focus-border{display:flex;align-items:flex-start;gap:var(--ic-space-xs);border-radius:var(--ic-border-radius);margin:calc(var(--ic-space-xxxs) / 2);padding:var(--ic-space-xxs);border:var(--ic-space-xxxs) dashed transparent;--icon-height:auto}:host(.ic-menu-item-disabled) ::part(button){color:var(--ic-popover-menu-item-check-disabled) !important;--ic-typography-color:var(--ic-popover-menu-item-check-disabled) !important;pointer-events:none}:host(.ic-menu-item-disabled) .menu-item-label,:host(.ic-menu-item-disabled) .shortcut,:host(.ic-menu-item-disabled) .menu-item-description{--ic-typography-color:var(--ic-popover-menu-item-label-disabled) !important}:host(.ic-menu-item-variant-destructive) ::part(button){color:var(--ic-popover-menu-destructive-item-icon);--ic-typography-color:var(--ic-popover-menu-destructive-item-label)}:host ::part(button):
|
|
14052
|
+
const icMenuItemCss = "/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=\"button\"],[type=\"reset\"],[type=\"submit\"]{-webkit-appearance:button}button::-moz-focus-inner,[type=\"button\"]::-moz-focus-inner,[type=\"reset\"]::-moz-focus-inner,[type=\"submit\"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=\"button\"]:-moz-focusring,[type=\"reset\"]:-moz-focusring,[type=\"submit\"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=\"checkbox\"],[type=\"radio\"]{box-sizing:border-box;padding:0;}[type=\"number\"]::-webkit-inner-spin-button,[type=\"number\"]::-webkit-outer-spin-button{height:auto}[type=\"search\"]{-webkit-appearance:textfield;outline-offset:-2px;}[type=\"search\"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font-style:inherit;vertical-align:baseline}:host ::part(button){color:var(--ic-popover-menu-item-check);--ic-typography-color:var(--ic-popover-menu-item-check);padding:calc(var(--ic-space-xxxs) / 2);display:flex;align-items:flex-start;gap:var(--ic-space-xs);border-radius:0;min-height:2.5rem;height:auto}.focus-border{display:flex;align-items:flex-start;gap:var(--ic-space-xs);border-radius:var(--ic-border-radius);margin:calc(var(--ic-space-xxxs) / 2);padding:var(--ic-space-xxs);border:var(--ic-space-xxxs) dashed transparent;--icon-height:auto}:host(.ic-menu-item-disabled) ::part(button){color:var(--ic-popover-menu-item-check-disabled) !important;--ic-typography-color:var(--ic-popover-menu-item-check-disabled) !important;pointer-events:none}:host(.ic-menu-item-disabled) .menu-item-label,:host(.ic-menu-item-disabled) .shortcut,:host(.ic-menu-item-disabled) .menu-item-description{--ic-typography-color:var(--ic-popover-menu-item-label-disabled) !important}:host(.ic-menu-item-variant-destructive) ::part(button){color:var(--ic-popover-menu-destructive-item-icon);--ic-typography-color:var(--ic-popover-menu-destructive-item-label)}:host(.ic-menu-item-variant-destructive) ::part(button):focus{background-color:var(--ic-popover-destructive-background-focus)}:host ::part(button):hover{background-color:var(--ic-popover-background-hover)}:host ::part(button):focus{box-shadow:none}:host ::part(button):focus,:host ::part(button):focus-visible{color:var(--ic-popover-menu-item-icon-focused);--ic-typography-color:var(--ic-popover-menu-item-label-focused);background-color:var(--ic-popover-background-focus)}ic-button:focus-within .menu-item-label,ic-button:focus-within .shortcut,ic-button:focus-within .menu-item-description{--ic-typography-color:var(--ic-popover-menu-item-label-focused)}:host(.ic-menu-item-disabled) ic-button:focus-within .focus-border{border-color:var(--ic-popover-menu-border)}:host(.ic-menu-item-disabled) ic-button:focus-within .menu-item-label,:host(.ic-menu-item-disabled) ic-button:focus-within .shortcut,:host(.ic-menu-item-disabled) ic-button:focus-within .menu-item-description{--ic-typography-color:var(--ic-popover-menu-item-label-disabled) !important}:host ::part(button):active{background-color:var(--ic-popover-background-pressed);color:var(--ic-popover-menu-item-label) !important;--ic-typography-color:var(--ic-popover-menu-item-label) !important}:host(.ic-menu-item-variant-destructive) ::part(button):active{background-color:var(--ic-popover-background-pressed);color:var(--ic-popover-menu-destructive-item-label) !important;--ic-typography-color:var(\n --ic-popover-menu-destructive-item-label\n ) !important}.menu-item-info{display:flex;flex-direction:column;flex:1;align-items:baseline;white-space:pre-line;text-align:left}.menu-labels{display:flex;align-items:baseline;gap:var(--ic-space-xs)}.menu-item-description{--ic-typography-color:var(--ic-popover-menu-item-description)}.shortcut{--ic-typography-color:var(--ic-popover-menu-item-shortcut);display:flex;flex:min-content}:host(.ic-menu-item-variant-destructive) .menu-item-label{text-transform:uppercase;font-weight:600;letter-spacing:0.025em}ic-button:active .menu-item-label{--ic-typography-color:var(--ic-popover-menu-item-label)}ic-button:active .menu-item-description{--ic-typography-color:var(--ic-popover-menu-item-description)}ic-button:active .shortcut{--ic-typography-color:var(--ic-popover-menu-item-shortcut)}:host(.ic-menu-item-variant-destructive) ic-button:active .menu-item-label{--ic-typography-color:var(\n --ic-popover-menu-destructive-item-label\n ) !important}.icon,.check-icon,.submenu-icon,.icon ::slotted(svg),.check-icon svg,.submenu-icon svg{width:var(--ic-space-lg);height:var(--ic-space-lg)}.check-icon.hide{visibility:hidden}@media (forced-colors: active){:host ::part(button){border:canvas}:host ::part(button):focus-visible{outline:var(--ic-space-xxxs) solid transparent}.focus-border{border-color:canvas}:host(.ic-menu-item-disabled) ic-button:focus-within .focus-border{border-color:GrayText}:host(.ic-menu-item-disabled) .menu-item-info,:host(.ic-menu-item-disabled) .menu-item-label,:host(.ic-menu-item-disabled) .shortcut,:host(.ic-menu-item-disabled) .menu-item-description,:host(.ic-menu-item-disabled) ic-button:focus-within .menu-item-info,:host(.ic-menu-item-disabled) ic-button:focus-within .menu-item-label,:host(.ic-menu-item-disabled) ic-button:focus-within .shortcut,:host(.ic-menu-item-disabled) ic-button:focus-within .menu-item-description{--ic-typography-color:GrayText !important}:host(.ic-menu-item-disabled) ::part(button):focus-visible,:host(.ic-menu-item-disabled) ::part(button):focus{outline-color:GrayText !important}}";
|
|
13202
14053
|
var IcMenuItemStyle0 = icMenuItemCss;
|
|
13203
14054
|
|
|
13204
14055
|
/**
|
|
@@ -13223,6 +14074,10 @@ class MenuItem {
|
|
|
13223
14074
|
* The variant of the menu item.
|
|
13224
14075
|
*/
|
|
13225
14076
|
this.variant = "default";
|
|
14077
|
+
/**
|
|
14078
|
+
* If `true`, the menu will close when this menu item is clicked.
|
|
14079
|
+
*/
|
|
14080
|
+
this.closeMenuOnSelect = true;
|
|
13226
14081
|
this.handleClick = (e) => {
|
|
13227
14082
|
if (isPropDefined(this.submenuTriggerFor)) {
|
|
13228
14083
|
this.triggerPopoverMenuInstance.emit();
|
|
@@ -13323,7 +14178,8 @@ class MenuItem {
|
|
|
13323
14178
|
"rel": [1],
|
|
13324
14179
|
"submenuTriggerFor": [1, "submenu-trigger-for"],
|
|
13325
14180
|
"target": [1],
|
|
13326
|
-
"variant": [1537]
|
|
14181
|
+
"variant": [1537],
|
|
14182
|
+
"closeMenuOnSelect": [4, "close-menu-on-select"]
|
|
13327
14183
|
},
|
|
13328
14184
|
"$listeners$": [[2, "click", "handleHostClick"]],
|
|
13329
14185
|
"$lazyBundleId$": "-",
|
|
@@ -15209,6 +16065,10 @@ class PopoverMenu {
|
|
|
15209
16065
|
* If `true`, the popover menu will be displayed.
|
|
15210
16066
|
*/
|
|
15211
16067
|
this.open = undefined;
|
|
16068
|
+
/**
|
|
16069
|
+
* If `always`, the popover menu will close when any menu item is clicked. If `toggle`, the popover menu will close when a non-toggle menu item is clicked. If `never`, the popover menu will not close when any menu item is clicked.
|
|
16070
|
+
*/
|
|
16071
|
+
this.closeOnItemSelect = "always";
|
|
15212
16072
|
this.setButtonFocus = () => {
|
|
15213
16073
|
var _a;
|
|
15214
16074
|
(_a = this.popoverMenuEls[this.currentFocus]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -15382,6 +16242,13 @@ class PopoverMenu {
|
|
|
15382
16242
|
}
|
|
15383
16243
|
handleMenuItemClick(ev) {
|
|
15384
16244
|
if (!ev.detail.submenuTriggerFor && ev.detail.label !== "Back") {
|
|
16245
|
+
if (this.closeOnItemSelect === "never" ||
|
|
16246
|
+
(ev.detail.variant === "toggle" &&
|
|
16247
|
+
this.closeOnItemSelect === "toggle") ||
|
|
16248
|
+
ev.detail.closeMenuOnSelect === false) {
|
|
16249
|
+
this.currentFocus = this.popoverMenuEls.findIndex((menuItem) => menuItem === ev.detail);
|
|
16250
|
+
return;
|
|
16251
|
+
}
|
|
15385
16252
|
this.closeMenu(false, ev.detail);
|
|
15386
16253
|
}
|
|
15387
16254
|
}
|
|
@@ -15477,19 +16344,19 @@ class PopoverMenu {
|
|
|
15477
16344
|
this.popperProps = props;
|
|
15478
16345
|
}
|
|
15479
16346
|
render() {
|
|
15480
|
-
return (hAsync(Host, { key: '
|
|
16347
|
+
return (hAsync(Host, { key: 'b664e4a0944016c88fe19232ea7b1cf2fa65cbd9', class: {
|
|
15481
16348
|
[`ic-theme-${this.theme}`]: this.theme !== "inherit",
|
|
15482
|
-
} }, isSlotUsed(this.el, "anchor") && hAsync("slot", { key: '
|
|
16349
|
+
} }, isSlotUsed(this.el, "anchor") && hAsync("slot", { key: '978425aac1a58c1f19ad59e8ebe9869492fe8a5d', name: "anchor" }), hAsync("div", { key: 'c36a21a4f9913deebed1c418ce4c85995fa49054', class: {
|
|
15483
16350
|
["ic-popover-menu"]: true,
|
|
15484
16351
|
["ic-popover-menu-open"]: !!this.open,
|
|
15485
|
-
} }, hAsync("div", { key: '
|
|
16352
|
+
} }, hAsync("div", { key: '5e54d43f8699270ea59ee2d408d099e73b51a5e0', id: this.parentPopover === undefined
|
|
15486
16353
|
? `ic-popover-submenu-${this.submenuId}`
|
|
15487
16354
|
: "", class: {
|
|
15488
16355
|
menu: true,
|
|
15489
|
-
} }, hAsync("span", { key: '
|
|
16356
|
+
} }, hAsync("span", { key: '50b901cdd6ce1c6e51839cdacb61034f45972a3a', class: {
|
|
15490
16357
|
"opening-from-parent": this.openingFromParent,
|
|
15491
16358
|
"opening-from-child": this.openingFromChild,
|
|
15492
|
-
} }, isPropDefined(this.submenuId) && (hAsync("span", { key: '
|
|
16359
|
+
} }, isPropDefined(this.submenuId) && (hAsync("span", { key: 'b152354aff6888ea5dd18850fb7ce40f3e7d975c' }, hAsync("span", { key: 'b7f43d96c7980573f740ff5d6495aa5416b6b89c', role: "menu" }, hAsync("ic-menu-item", { key: '62eb52181ef3b9c647573202a90940f3f90b2b1f', class: "ic-popover-submenu-back-button", ref: (el) => (this.backButton = el), label: "Back", onClick: this.handleBackButtonClick, id: `ic-popover-submenu-back-button-${this.submenuLevel}` }, hAsync("svg", { key: 'ea5fe2b6bedb7a97c146e9bf19f0c4538bcd7cc4', slot: "icon", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: "submenu-back-icon" }, hAsync("path", { key: '57795916b6c3026915b4b166647512bc7b2571e0', d: "M20 11H7.83L13.42 5.41L12 4L4 12L12 20L13.41 18.59L7.83 13H20V11Z", fill: "currentColor" })))), hAsync("ic-typography", { key: 'c6b1a275a79f431eb9c32b8b811302c2bc7e86a2', variant: "subtitle-small", class: "parent-label" }, this.parentLabel))), hAsync("div", { key: 'a227dd549ab5bc60aad95d62d4ab8a13fdd4e46f', class: "menu-body", "aria-label": this.getMenuAriaLabel(), role: "menu" }, hAsync("slot", { key: '5f991353095b3d406ff76d101be9c72dd1ff26b7' })))))));
|
|
15493
16360
|
}
|
|
15494
16361
|
static get delegatesFocus() { return true; }
|
|
15495
16362
|
get el() { return getElement(this); }
|
|
@@ -15509,6 +16376,7 @@ class PopoverMenu {
|
|
|
15509
16376
|
"submenuLevel": [2, "submenu-level"],
|
|
15510
16377
|
"theme": [1],
|
|
15511
16378
|
"open": [1540],
|
|
16379
|
+
"closeOnItemSelect": [1, "close-on-item-select"],
|
|
15512
16380
|
"openingFromChild": [32],
|
|
15513
16381
|
"openingFromParent": [32],
|
|
15514
16382
|
"popperProps": [32],
|