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