@ukic/web-components 3.29.0 → 3.30.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-accordion.js +53 -38
- package/components/ic-accordion.js.map +1 -1
- package/components/ic-menu2.js +274 -35
- package/components/ic-menu2.js.map +1 -1
- package/components/ic-navigation-button.js +8 -5
- package/components/ic-navigation-button.js.map +1 -1
- package/components/ic-pagination-bar.js.map +1 -1
- package/components/ic-skip-link.js.map +1 -1
- package/components/ic-status-tag.js.map +1 -1
- package/components/ic-switch.js.map +1 -1
- package/dist/cjs/ic-accordion.cjs.entry.js +53 -38
- package/dist/cjs/ic-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-horizontal-scroll.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js +274 -35
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-button.cjs.entry.js +8 -5
- package/dist/cjs/ic-navigation-button.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-section-container.cjs.entry.js.map +1 -1
- package/dist/collection/components/ic-accordion/ic-accordion.js +53 -38
- package/dist/collection/components/ic-accordion/ic-accordion.js.map +1 -1
- package/dist/collection/components/ic-navigation-button/ic-navigation-button.js +8 -5
- package/dist/collection/components/ic-navigation-button/ic-navigation-button.js.map +1 -1
- package/dist/components/ic-accordion.js +53 -38
- package/dist/components/ic-accordion.js.map +1 -1
- package/dist/components/ic-back-to-top.js.map +1 -1
- package/dist/components/ic-hero.js.map +1 -1
- package/dist/components/ic-menu2.js +274 -35
- package/dist/components/ic-menu2.js.map +1 -1
- package/dist/components/ic-navigation-button.js +8 -5
- package/dist/components/ic-navigation-button.js.map +1 -1
- package/dist/components/ic-pagination-bar.js.map +1 -1
- package/dist/components/ic-popover-menu.js.map +1 -1
- package/dist/components/ic-radio-group.js.map +1 -1
- package/dist/components/ic-radio-option.js.map +1 -1
- package/dist/components/ic-search-bar.js.map +1 -1
- package/dist/components/ic-skip-link.js.map +1 -1
- package/dist/components/ic-status-tag.js.map +1 -1
- package/dist/components/ic-switch.js.map +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/{p-9ced00a7.entry.js → p-41bbdc4c.entry.js} +2 -2
- package/dist/core/{p-9ced00a7.entry.js.map → p-41bbdc4c.entry.js.map} +1 -1
- package/dist/core/p-8fc5e9f9.entry.js.map +1 -1
- package/dist/core/p-98dee727.entry.js.map +1 -1
- package/dist/core/{p-fc4b7d2b.entry.js → p-9cf35c23.entry.js} +2 -2
- package/dist/core/p-9cf35c23.entry.js.map +1 -0
- package/dist/core/p-a8d98164.entry.js.map +1 -1
- package/dist/core/p-ccba84b7.entry.js +3 -0
- package/dist/core/p-ccba84b7.entry.js.map +1 -0
- package/dist/esm/ic-accordion.entry.js +53 -38
- package/dist/esm/ic-accordion.entry.js.map +1 -1
- package/dist/esm/ic-button_3.entry.js.map +1 -1
- package/dist/esm/ic-horizontal-scroll.entry.js.map +1 -1
- package/dist/esm/ic-input-component-container_3.entry.js +274 -35
- package/dist/esm/ic-input-component-container_3.entry.js.map +1 -1
- package/dist/esm/ic-navigation-button.entry.js +8 -5
- package/dist/esm/ic-navigation-button.entry.js.map +1 -1
- package/dist/esm/ic-section-container.entry.js.map +1 -1
- package/dist/types/components/ic-accordion/ic-accordion.d.ts +2 -0
- package/hydrate/index.js +334 -77
- package/hydrate/index.mjs +334 -77
- package/package.json +1 -1
- package/dist/core/p-305d9639.entry.js +0 -3
- package/dist/core/p-305d9639.entry.js.map +0 -1
- package/dist/core/p-fc4b7d2b.entry.js.map +0 -1
package/hydrate/index.js
CHANGED
|
@@ -3866,16 +3866,9 @@ class Accordion {
|
|
|
3866
3866
|
};
|
|
3867
3867
|
// Set accordion animation
|
|
3868
3868
|
this.setAccordionAnimation = (el, duration, property, delay) => {
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
el.style.transitionDelay = delay;
|
|
3873
|
-
}
|
|
3874
|
-
else {
|
|
3875
|
-
el.style.transitionDuration = "0ms";
|
|
3876
|
-
el.style.transitionProperty = "none";
|
|
3877
|
-
el.style.transitionDelay = "0ms";
|
|
3878
|
-
}
|
|
3869
|
+
el.style.transitionDuration = `${duration}ms`;
|
|
3870
|
+
el.style.transitionProperty = property;
|
|
3871
|
+
el.style.transitionTimingFunction = delay;
|
|
3879
3872
|
};
|
|
3880
3873
|
this.setExpandedContentStyle = (ev, expandedContent) => {
|
|
3881
3874
|
if (ev.propertyName === "height" && expandedContent.clientHeight > 0) {
|
|
@@ -3889,30 +3882,52 @@ class Accordion {
|
|
|
3889
3882
|
}
|
|
3890
3883
|
};
|
|
3891
3884
|
this.animateExpandedContent = () => {
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
expandedContentEl.addEventListener("transitionend", (e) => {
|
|
3900
|
-
this.setExpandedContentStyle(e, expandedContentEl);
|
|
3901
|
-
});
|
|
3902
|
-
}
|
|
3903
|
-
else if (!this.expanded) {
|
|
3904
|
-
const expandedContentEl = this.expandedContentEl;
|
|
3905
|
-
expandedContentEl.style.height = `${expandedContentEl.scrollHeight}px`;
|
|
3906
|
-
if (expandedContentEl.scrollHeight > 0 && !this.expanded) {
|
|
3907
|
-
expandedContentEl.style.height = "0";
|
|
3908
|
-
this.setAccordionAnimation(expandedContentEl, "300", "height", "ease-in");
|
|
3909
|
-
expandedContentEl.classList.remove(EXPANDED_CONTENT_OPENED_CLASS);
|
|
3910
|
-
}
|
|
3911
|
-
expandedContentEl.addEventListener("transitionend", (e) => {
|
|
3912
|
-
this.hideExpandedContent(e, expandedContentEl);
|
|
3913
|
-
});
|
|
3914
|
-
}
|
|
3885
|
+
const expandedContentEl = this.expandedContentEl;
|
|
3886
|
+
if (!expandedContentEl)
|
|
3887
|
+
return;
|
|
3888
|
+
const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3889
|
+
if (this.expanded) {
|
|
3890
|
+
this.expandContent(expandedContentEl, prefersReducedMotion);
|
|
3891
|
+
return;
|
|
3915
3892
|
}
|
|
3893
|
+
this.collapseContent(expandedContentEl, prefersReducedMotion);
|
|
3894
|
+
};
|
|
3895
|
+
this.expandContent = (expandedContentEl, prefersReducedMotion) => {
|
|
3896
|
+
const elementHeight = expandedContentEl.scrollHeight;
|
|
3897
|
+
if (elementHeight <= 0)
|
|
3898
|
+
return;
|
|
3899
|
+
expandedContentEl.style.setProperty(this.CONTENT_VISIBILITY_PROPERTY, "visible");
|
|
3900
|
+
if (prefersReducedMotion) {
|
|
3901
|
+
expandedContentEl.classList.add(EXPANDED_CONTENT_OPENED_CLASS);
|
|
3902
|
+
expandedContentEl.style.height = "auto";
|
|
3903
|
+
return;
|
|
3904
|
+
}
|
|
3905
|
+
expandedContentEl.style.height = `${elementHeight}px`;
|
|
3906
|
+
this.setAccordionAnimation(expandedContentEl, "300", "height", "ease-out");
|
|
3907
|
+
expandedContentEl.addEventListener("transitionend", (e) => {
|
|
3908
|
+
this.setExpandedContentStyle(e, expandedContentEl);
|
|
3909
|
+
}, { once: true });
|
|
3910
|
+
};
|
|
3911
|
+
this.collapseContent = (expandedContentEl, prefersReducedMotion) => {
|
|
3912
|
+
const elementHeight = expandedContentEl.scrollHeight;
|
|
3913
|
+
if (elementHeight <= 0)
|
|
3914
|
+
return;
|
|
3915
|
+
// Set the content panel as pixels from "auto" so it can be animated
|
|
3916
|
+
expandedContentEl.style.height = `${elementHeight}px`;
|
|
3917
|
+
if (prefersReducedMotion) {
|
|
3918
|
+
expandedContentEl.style.height = "0";
|
|
3919
|
+
expandedContentEl.classList.remove(EXPANDED_CONTENT_OPENED_CLASS);
|
|
3920
|
+
expandedContentEl.style.setProperty(this.CONTENT_VISIBILITY_PROPERTY, "hidden");
|
|
3921
|
+
return;
|
|
3922
|
+
}
|
|
3923
|
+
requestAnimationFrame(() => {
|
|
3924
|
+
expandedContentEl.style.height = "0";
|
|
3925
|
+
});
|
|
3926
|
+
this.setAccordionAnimation(expandedContentEl, "300", "height", "ease-in");
|
|
3927
|
+
expandedContentEl.classList.remove(EXPANDED_CONTENT_OPENED_CLASS);
|
|
3928
|
+
expandedContentEl.addEventListener("transitionend", (e) => {
|
|
3929
|
+
this.hideExpandedContent(e, expandedContentEl);
|
|
3930
|
+
}, { once: true });
|
|
3916
3931
|
};
|
|
3917
3932
|
}
|
|
3918
3933
|
watchDisabledHandler() {
|
|
@@ -3949,19 +3964,19 @@ class Accordion {
|
|
|
3949
3964
|
}
|
|
3950
3965
|
render() {
|
|
3951
3966
|
const { size, disabled, expanded, theme } = this;
|
|
3952
|
-
return (hAsync(Host, { key: '
|
|
3967
|
+
return (hAsync(Host, { key: '840baa7799dc4c48c232a7dc170937bb563900d5', id: this.accordionId, class: {
|
|
3953
3968
|
["ic-accordion-disabled"]: !!disabled,
|
|
3954
3969
|
[`ic-theme-${theme}`]: theme !== "inherit",
|
|
3955
|
-
}, "aria-disabled": disabled ? "true" : "false" }, hAsync("button", { key: '
|
|
3970
|
+
}, "aria-disabled": disabled ? "true" : "false" }, hAsync("button", { key: 'dce03cb5ba0f61a1d5b75ab1f648eaa970d5d78e', ref: (el) => (this.accordionBtnHeading = el), id: `${this.accordionId}-button`, disabled: disabled, tabindex: disabled ? -1 : 0, class: {
|
|
3956
3971
|
[`${size}`]: true,
|
|
3957
3972
|
["section-button"]: true,
|
|
3958
3973
|
["section-button-open"]: !!expanded && !disabled,
|
|
3959
|
-
}, "aria-expanded": `${expanded}`, "aria-controls": "expanded-content-area", onClick: this.toggleExpanded }, isSlotUsed(this.el, "icon") && (hAsync("div", { key: '
|
|
3974
|
+
}, "aria-expanded": `${expanded}`, "aria-controls": "expanded-content-area", onClick: this.toggleExpanded }, isSlotUsed(this.el, "icon") && (hAsync("div", { key: '3301b5e4526831e7e8a4400d775f55d99ec29d27', class: "icon-container" }, hAsync("slot", { key: 'aa49cdcd343009d6d5b7e68f5c1013cd7fcc7638', name: "icon" }))), hAsync("ic-typography", { key: 'da324db78e29a81f0c5bb7209f870b8832c25d67', variant: "subtitle-large", class: "section-header" }, isSlotUsed(this.el, "heading") ? (hAsync("slot", { name: "heading" })) : (this.heading)), hAsync("span", { key: '9eb1350c8ae3f9c940e1299a17b3b510ccb66ef6', class: {
|
|
3960
3975
|
["expand-chevron"]: true,
|
|
3961
3976
|
["content-expanded-chevron"]: !!expanded && !disabled,
|
|
3962
|
-
}, "aria-hidden": "true", innerHTML: chevronIcon })), hAsync("div", { key: '
|
|
3977
|
+
}, "aria-hidden": "true", innerHTML: chevronIcon })), hAsync("div", { key: '9b04e4a6df4def67189609215cd4849890900146', class: {
|
|
3963
3978
|
["expanded-content"]: true,
|
|
3964
|
-
}, "aria-labelledby": `${this.accordionId}-button`, role: "region", "aria-hidden": `${!expanded}`, id: "expanded-content-area", ref: (el) => (this.expandedContentEl = el) }, hAsync("div", { key: '
|
|
3979
|
+
}, "aria-labelledby": `${this.accordionId}-button`, role: "region", "aria-hidden": `${!expanded}`, id: "expanded-content-area", ref: (el) => (this.expandedContentEl = el) }, hAsync("div", { key: '594f88da687634cbbad7e12d8df21a3dc7961a64', class: "expanded-content-inner" }, this.message ? (hAsync("ic-typography", { variant: "body" }, this.message)) : (hAsync("slot", null))))));
|
|
3965
3980
|
}
|
|
3966
3981
|
get el() { return getElement(this); }
|
|
3967
3982
|
static get watchers() { return {
|
|
@@ -10632,7 +10647,7 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof win
|
|
|
10632
10647
|
|
|
10633
10648
|
var purify = {exports: {}};
|
|
10634
10649
|
|
|
10635
|
-
/*! @license DOMPurify 3.4.
|
|
10650
|
+
/*! @license DOMPurify 3.4.13 | (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.13/LICENSE */
|
|
10636
10651
|
|
|
10637
10652
|
(function (module, exports) {
|
|
10638
10653
|
(function (global, factory) {
|
|
@@ -10949,7 +10964,7 @@ var purify = {exports: {}};
|
|
|
10949
10964
|
const text = freeze(['#text']);
|
|
10950
10965
|
|
|
10951
10966
|
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']);
|
|
10952
|
-
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
10967
|
+
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', 'dominant-baseline', '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-orientation', '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']);
|
|
10953
10968
|
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']);
|
|
10954
10969
|
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
10955
10970
|
|
|
@@ -11062,7 +11077,7 @@ var purify = {exports: {}};
|
|
|
11062
11077
|
function createDOMPurify() {
|
|
11063
11078
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
11064
11079
|
const DOMPurify = root => createDOMPurify(root);
|
|
11065
|
-
DOMPurify.version = '3.4.
|
|
11080
|
+
DOMPurify.version = '3.4.13';
|
|
11066
11081
|
DOMPurify.removed = [];
|
|
11067
11082
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
11068
11083
|
// Not running in a browser, provide a factory function
|
|
@@ -11089,6 +11104,7 @@ var purify = {exports: {}};
|
|
|
11089
11104
|
const getAttributes = lookupGetter(ElementPrototype, 'attributes');
|
|
11090
11105
|
const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, 'nodeType') : null;
|
|
11091
11106
|
const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, 'nodeName') : null;
|
|
11107
|
+
const getOwnerDocument = Node && Node.prototype ? lookupGetter(Node.prototype, 'ownerDocument') : null;
|
|
11092
11108
|
// As per issue #47, the web-components registry is inherited by a
|
|
11093
11109
|
// new document created via createHTMLDocument. As per the spec
|
|
11094
11110
|
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
@@ -11740,6 +11756,13 @@ var purify = {exports: {}};
|
|
|
11740
11756
|
* @param root the in-place root to empty
|
|
11741
11757
|
*/
|
|
11742
11758
|
const _neutralizeRoot = function _neutralizeRoot(root) {
|
|
11759
|
+
/* Strip every disallowed attribute (on* handlers included) off the whole
|
|
11760
|
+
subtree BEFORE detaching anything. Detaching first would hand back
|
|
11761
|
+
handler-bearing originals (e.g. an already-loading `<img onerror>`)
|
|
11762
|
+
whose queued resource event still fires in page scope after we throw.
|
|
11763
|
+
Clobber-safe reads; a doomed clobbered node's own attributes are
|
|
11764
|
+
irrelevant while its non-clobbered descendants are reached and scrubbed. */
|
|
11765
|
+
_neutralizeSubtree(root);
|
|
11743
11766
|
const childNodes = getChildNodes(root);
|
|
11744
11767
|
if (childNodes) {
|
|
11745
11768
|
const snapshot = [];
|
|
@@ -11867,6 +11890,82 @@ var purify = {exports: {}};
|
|
|
11867
11890
|
}
|
|
11868
11891
|
}
|
|
11869
11892
|
};
|
|
11893
|
+
/**
|
|
11894
|
+
* _neutralizePatchLinkage
|
|
11895
|
+
*
|
|
11896
|
+
* IN_PLACE entry pre-pass (declarative-partial-updates / streaming
|
|
11897
|
+
* hardening, https://github.com/WICG/declarative-partial-updates).
|
|
11898
|
+
*
|
|
11899
|
+
* The main walk strips patch linkage (`for`/`patchsrc`) and removes range
|
|
11900
|
+
* markers (PIs / markup comments) node-by-node, in document order, AS it
|
|
11901
|
+
* reaches each node. On a live in-place root that leaves a window: from the
|
|
11902
|
+
* moment the root is connected until the walk arrives at a given node, that
|
|
11903
|
+
* node's linkage is live. A patch applied on connection/stream can fire as
|
|
11904
|
+
* a microtask during the walk and inject or teleport an unsanitized DOM
|
|
11905
|
+
* range into a region the iterator has already passed and will not revisit,
|
|
11906
|
+
* so the post-return "tree is sanitized" contract is violated. Sweep the
|
|
11907
|
+
* whole tree once up front and sever every linkage before the walk begins,
|
|
11908
|
+
* closing that window.
|
|
11909
|
+
*
|
|
11910
|
+
* This CANNOT undo a patch that already fired before sanitize ran — that is
|
|
11911
|
+
* the irreducible "do not IN_PLACE a live-connected attacker tree" caveat —
|
|
11912
|
+
* but it closes everything from sanitize-start onward. Gated on SAFE_FOR_XML
|
|
11913
|
+
* to group with the rest of the declarative-partial-updates handling and
|
|
11914
|
+
* stay overridable, consistent with the codebase.
|
|
11915
|
+
*
|
|
11916
|
+
* Clobber-safe traversal (cached childNodes getter); per-node try/catch so a
|
|
11917
|
+
* clobbered root cannot defeat the sweep of its non-clobbered descendants.
|
|
11918
|
+
*
|
|
11919
|
+
* NOTE (pending real-Chrome confirmation, see test/declarative-patch-probe
|
|
11920
|
+
* .html Q1): this mirrors the existing policy of keeping `for` on
|
|
11921
|
+
* <label>/<output>. If the shipping feature can drive a patch through a
|
|
11922
|
+
* surviving `for`-on-label/output + `id` pair, this pre-pass and the
|
|
11923
|
+
* attribute check at _isBasicCustomElement's caller must additionally drop
|
|
11924
|
+
* that pair on the IN_PLACE path. Left as-is until the taxonomy is verified.
|
|
11925
|
+
*
|
|
11926
|
+
* @param root the in-place root to sweep
|
|
11927
|
+
*/
|
|
11928
|
+
const _neutralizePatchLinkage = function _neutralizePatchLinkage(root) {
|
|
11929
|
+
if (!SAFE_FOR_XML) {
|
|
11930
|
+
return;
|
|
11931
|
+
}
|
|
11932
|
+
const stack = [root];
|
|
11933
|
+
while (stack.length > 0) {
|
|
11934
|
+
const node = stack.pop();
|
|
11935
|
+
const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
|
|
11936
|
+
/* Remove range markers (the target side of a patch linkage): every
|
|
11937
|
+
processing instruction, and any markup-bearing comment. */
|
|
11938
|
+
if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
|
|
11939
|
+
try {
|
|
11940
|
+
remove(node);
|
|
11941
|
+
} catch (_) {
|
|
11942
|
+
/* Best-effort */
|
|
11943
|
+
}
|
|
11944
|
+
continue;
|
|
11945
|
+
}
|
|
11946
|
+
/* Strip patch-source attributes (the source side) off elements. */
|
|
11947
|
+
if (nodeType === NODE_TYPE.element) {
|
|
11948
|
+
const element = node;
|
|
11949
|
+
const lcTag = transformCaseFunc(getNodeName ? getNodeName(node) : node.nodeName);
|
|
11950
|
+
try {
|
|
11951
|
+
if (element.hasAttribute && element.hasAttribute('patchsrc')) {
|
|
11952
|
+
element.removeAttribute('patchsrc');
|
|
11953
|
+
}
|
|
11954
|
+
if (element.hasAttribute && element.hasAttribute('for') && lcTag !== 'label' && lcTag !== 'output') {
|
|
11955
|
+
element.removeAttribute('for');
|
|
11956
|
+
}
|
|
11957
|
+
} catch (_) {
|
|
11958
|
+
/* Clobbered removeAttribute/hasAttribute on a doomed node — ignore */
|
|
11959
|
+
}
|
|
11960
|
+
}
|
|
11961
|
+
const childNodes = getChildNodes(node);
|
|
11962
|
+
if (childNodes) {
|
|
11963
|
+
for (let i = childNodes.length - 1; i >= 0; --i) {
|
|
11964
|
+
stack.push(childNodes[i]);
|
|
11965
|
+
}
|
|
11966
|
+
}
|
|
11967
|
+
}
|
|
11968
|
+
};
|
|
11870
11969
|
/**
|
|
11871
11970
|
* _initDocument
|
|
11872
11971
|
*
|
|
@@ -11924,7 +12023,17 @@ var purify = {exports: {}};
|
|
|
11924
12023
|
* @return The created NodeIterator
|
|
11925
12024
|
*/
|
|
11926
12025
|
const _createNodeIterator = function _createNodeIterator(root) {
|
|
11927
|
-
|
|
12026
|
+
/* Read ownerDocument through the cached Node.prototype getter, never the
|
|
12027
|
+
direct property. HTMLFormElement has [LegacyOverrideBuiltIns], so a
|
|
12028
|
+
clobbering child (<input name="ownerDocument"> or a form-associated
|
|
12029
|
+
external input) shadows the prototype getter and makes a direct read
|
|
12030
|
+
return that <input>. createNodeIterator.call(<input>, ...) then throws
|
|
12031
|
+
"Illegal invocation", and on the IN_PLACE path that throw lands before
|
|
12032
|
+
the walk's fail-closed barrier - leaving the caller's live tree, with
|
|
12033
|
+
any already-armed handler in it, un-neutralized. The cached getter
|
|
12034
|
+
returns the real Document regardless of the clobber. */
|
|
12035
|
+
const doc = getOwnerDocument ? getOwnerDocument(root) : root.ownerDocument;
|
|
12036
|
+
return createNodeIterator.call(doc || root, root,
|
|
11928
12037
|
// eslint-disable-next-line no-bitwise
|
|
11929
12038
|
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
|
|
11930
12039
|
};
|
|
@@ -11964,7 +12073,11 @@ var purify = {exports: {}};
|
|
|
11964
12073
|
const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
|
|
11965
12074
|
var _node$querySelectorAl;
|
|
11966
12075
|
node.normalize();
|
|
11967
|
-
|
|
12076
|
+
/* Clobber-safe ownerDocument read, same reasoning as _createNodeIterator:
|
|
12077
|
+
under SAFE_FOR_TEMPLATES this runs on the live IN_PLACE root, which may
|
|
12078
|
+
carry a form-named-getter override of ownerDocument. */
|
|
12079
|
+
const doc = getOwnerDocument ? getOwnerDocument(node) : node.ownerDocument;
|
|
12080
|
+
const walker = createNodeIterator.call(doc || node, node,
|
|
11968
12081
|
// eslint-disable-next-line no-bitwise
|
|
11969
12082
|
NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
|
|
11970
12083
|
let currentNode = walker.nextNode();
|
|
@@ -12117,15 +12230,21 @@ var purify = {exports: {}};
|
|
|
12117
12230
|
/**
|
|
12118
12231
|
* Handle a node whose tag is forbidden or not allowlisted: keep
|
|
12119
12232
|
* allowed custom elements (false return exits _sanitizeElements
|
|
12120
|
-
* early - namespace
|
|
12121
|
-
*
|
|
12122
|
-
*
|
|
12233
|
+
* early - the namespace and fallback-tag removal checks are
|
|
12234
|
+
* intentionally skipped for kept custom elements), else hoist
|
|
12235
|
+
* content per KEEP_CONTENT and remove.
|
|
12236
|
+
*
|
|
12237
|
+
* A kept custom element is the ONLY case in which this function
|
|
12238
|
+
* returns false, so the caller uses that return value to run the
|
|
12239
|
+
* afterSanitizeElements hook on the kept element and keep the
|
|
12240
|
+
* element-hook lifecycle consistent with normal allowlisted
|
|
12241
|
+
* elements (GHSA-c2j3-45gr-mqc4).
|
|
12123
12242
|
*
|
|
12124
12243
|
* @param currentNode the disallowed node
|
|
12125
12244
|
* @param tagName the node's transformCaseFunc'd tag name
|
|
12126
12245
|
* @return true if the node was removed, false if kept
|
|
12127
12246
|
*/
|
|
12128
|
-
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName) {
|
|
12247
|
+
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName, root) {
|
|
12129
12248
|
/* Check if we have a custom element to handle */
|
|
12130
12249
|
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
12131
12250
|
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
@@ -12148,27 +12267,26 @@ var purify = {exports: {}};
|
|
|
12148
12267
|
const childNodes = getChildNodes(currentNode);
|
|
12149
12268
|
if (childNodes && parentNode) {
|
|
12150
12269
|
const childCount = childNodes.length;
|
|
12151
|
-
/*
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
event to neutralise.
|
|
12270
|
+
/* Hoist by moving each child up one level rather than deep-cloning
|
|
12271
|
+
it. Moving transfers every descendant exactly once, so a chain of
|
|
12272
|
+
nested disallowed elements costs O(n) instead of the O(n^2) that
|
|
12273
|
+
re-cloning the shrinking subtree at each level produced; it also
|
|
12274
|
+
empties the removed original, so `DOMPurify.removed` no longer
|
|
12275
|
+
pins whole subtrees. Moving preserves the in-place guarantee too:
|
|
12276
|
+
an original carrying already-queued resource events (`<img
|
|
12277
|
+
onerror>`, `<video>`/`<audio>` error, lazy/`onload`, …) is
|
|
12278
|
+
relocated and sanitised rather than left detached but still armed.
|
|
12279
|
+
The sole case that must clone is removing the walk root itself.
|
|
12280
|
+
The result is serialised from the root's subtree, so a restrictive
|
|
12281
|
+
ALLOWED_TAGS that strips the root (`body` on the string path) must
|
|
12282
|
+
leave the content inside it, which only cloning does. In IN_PLACE
|
|
12283
|
+
the root is pre-validated as an allowed tag and so is never removed
|
|
12284
|
+
here, so that path always takes the move branch.
|
|
12167
12285
|
`childNodes` is live; a tail-to-head walk keeps `childNodes[i]`
|
|
12168
12286
|
valid whether we move (drops the trailing entry) or clone (leaves
|
|
12169
12287
|
the list intact). */
|
|
12170
12288
|
for (let i = childCount - 1; i >= 0; --i) {
|
|
12171
|
-
const hoisted =
|
|
12289
|
+
const hoisted = currentNode === root ? cloneNode(childNodes[i], true) : childNodes[i];
|
|
12172
12290
|
parentNode.insertBefore(hoisted, getNextSibling(currentNode));
|
|
12173
12291
|
}
|
|
12174
12292
|
}
|
|
@@ -12176,6 +12294,26 @@ var purify = {exports: {}};
|
|
|
12176
12294
|
_forceRemove(currentNode);
|
|
12177
12295
|
return true;
|
|
12178
12296
|
};
|
|
12297
|
+
/**
|
|
12298
|
+
* Fork a hook-mutable allowlist off its shared binding the first time a
|
|
12299
|
+
* (possibly lazily-installed) uponSanitize* hook is about to see it, so the
|
|
12300
|
+
* hook cannot widen the per-instance default or the setConfig binding by
|
|
12301
|
+
* reference and leak past the call. Returns the set unchanged once it is
|
|
12302
|
+
* already call-local, so repeated calls across elements are idempotent.
|
|
12303
|
+
*
|
|
12304
|
+
* @param hookList the uponSanitize* hook array for this event
|
|
12305
|
+
* @param set the current ALLOWED_TAGS / ALLOWED_ATTR binding
|
|
12306
|
+
* @param defaultSet the per-instance DEFAULT_ALLOWED_* constant
|
|
12307
|
+
* @param setConfigSet the captured setConfig() binding, or null
|
|
12308
|
+
* @return a call-local clone if a hook is present and set is still shared,
|
|
12309
|
+
* else set unchanged
|
|
12310
|
+
*/
|
|
12311
|
+
const _forkSharedAllowlist = function _forkSharedAllowlist(hookList, set, defaultSet, setConfigSet) {
|
|
12312
|
+
if (hookList.length === 0) {
|
|
12313
|
+
return set;
|
|
12314
|
+
}
|
|
12315
|
+
return set === defaultSet || set === setConfigSet ? clone(set) : set;
|
|
12316
|
+
};
|
|
12179
12317
|
/**
|
|
12180
12318
|
* _sanitizeElements
|
|
12181
12319
|
*
|
|
@@ -12185,9 +12323,20 @@ var purify = {exports: {}};
|
|
|
12185
12323
|
* @param currentNode to check for permission to exist
|
|
12186
12324
|
* @return true if node was killed, false if left alive
|
|
12187
12325
|
*/
|
|
12188
|
-
|
|
12326
|
+
// eslint-disable-next-line complexity
|
|
12327
|
+
const _sanitizeElements = function _sanitizeElements(currentNode, root) {
|
|
12189
12328
|
/* Execute a hook if present */
|
|
12190
12329
|
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
12330
|
+
/* A hook may have detached the node - treat it as removed (see the
|
|
12331
|
+
detached-node comment after the uponSanitizeElement hook below). On
|
|
12332
|
+
the IN_PLACE path, neutralize the detached subtree first so a queued
|
|
12333
|
+
resource handler on it cannot fire in page scope after we return. */
|
|
12334
|
+
if (currentNode !== root && getParentNode(currentNode) === null) {
|
|
12335
|
+
if (IN_PLACE) {
|
|
12336
|
+
_neutralizeSubtree(currentNode);
|
|
12337
|
+
}
|
|
12338
|
+
return true;
|
|
12339
|
+
}
|
|
12191
12340
|
/* Check if element is clobbered or can clobber */
|
|
12192
12341
|
if (_isClobbered(currentNode)) {
|
|
12193
12342
|
_forceRemove(currentNode);
|
|
@@ -12195,11 +12344,47 @@ var purify = {exports: {}};
|
|
|
12195
12344
|
}
|
|
12196
12345
|
/* Now let's check the element's type and name */
|
|
12197
12346
|
const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
|
|
12347
|
+
/* Close the pre-walk clone-guard's timing gap: an uponSanitizeElement
|
|
12348
|
+
hook may have been installed after that guard sampled the hook arrays
|
|
12349
|
+
(e.g. lazily from beforeSanitizeElements), leaving ALLOWED_TAGS still
|
|
12350
|
+
aliasing a shared binding that a widening hook would mutate by
|
|
12351
|
+
reference. Fork it before exposing it to the hook. */
|
|
12352
|
+
ALLOWED_TAGS = _forkSharedAllowlist(hooks.uponSanitizeElement, ALLOWED_TAGS, DEFAULT_ALLOWED_TAGS, SET_CONFIG_ALLOWED_TAGS);
|
|
12198
12353
|
/* Execute a hook if present */
|
|
12199
12354
|
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
12200
12355
|
tagName,
|
|
12201
12356
|
allowedTags: ALLOWED_TAGS
|
|
12202
12357
|
});
|
|
12358
|
+
/* A hook may have detached the node from the tree — a long-standing
|
|
12359
|
+
user pattern (issue #469; draw.io-style foreignObject filtering).
|
|
12360
|
+
Per the cached, unclobberable parentNode getter the node is
|
|
12361
|
+
genuinely out of the tree, so it can reach neither the serialized
|
|
12362
|
+
output nor an IN_PLACE live tree; treat it as removed and stop
|
|
12363
|
+
processing it. Without this guard, the unsafe-node / namespace
|
|
12364
|
+
checks below would call _forceRemove on a parentless node and hit
|
|
12365
|
+
the REPORT-3 fail-closed throw — which exists for nodes DOMPurify
|
|
12366
|
+
wants gone but *cannot* detach (clobbered / parentless roots), the
|
|
12367
|
+
opposite of a node that is already safely gone. The walk root is
|
|
12368
|
+
exempt: a detached IN_PLACE root is legitimate input and must still
|
|
12369
|
+
be fully sanitized, and a kill-decision on it must keep hitting the
|
|
12370
|
+
REPORT-3 throw. Nodes detached by hooks stay the hook's
|
|
12371
|
+
responsibility for placement: they are not recorded in
|
|
12372
|
+
DOMPurify.removed, so the post-walk IN_PLACE pass (which iterates
|
|
12373
|
+
DOMPurify.removed) does not reach them. But a hook-detached subtree
|
|
12374
|
+
can still hold a queued resource-event handler - e.g. an <img onload>
|
|
12375
|
+
that began loading when the caller built the live tree - which fires
|
|
12376
|
+
in page scope after sanitize returns even though the handler never
|
|
12377
|
+
reached the returned tree. That is the audit-5 F1 hazard, and the
|
|
12378
|
+
documented node.remove() hook pattern walks straight into it. So on
|
|
12379
|
+
the IN_PLACE path we neutralize the detached subtree inline here,
|
|
12380
|
+
stripping its non-allow-listed attributes before returning, exactly
|
|
12381
|
+
as the post-walk pass does for _forceRemove'd subtrees. */
|
|
12382
|
+
if (currentNode !== root && getParentNode(currentNode) === null) {
|
|
12383
|
+
if (IN_PLACE) {
|
|
12384
|
+
_neutralizeSubtree(currentNode);
|
|
12385
|
+
}
|
|
12386
|
+
return true;
|
|
12387
|
+
}
|
|
12203
12388
|
/* Remove mXSS vectors, processing instructions and risky comments */
|
|
12204
12389
|
if (_isUnsafeNode(currentNode, tagName)) {
|
|
12205
12390
|
_forceRemove(currentNode);
|
|
@@ -12207,7 +12392,22 @@ var purify = {exports: {}};
|
|
|
12207
12392
|
}
|
|
12208
12393
|
/* Remove element if anything forbids its presence */
|
|
12209
12394
|
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
12210
|
-
|
|
12395
|
+
const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
|
|
12396
|
+
/* A false return means the node is a custom element kept via
|
|
12397
|
+
CUSTOM_ELEMENT_HANDLING - the only keep path through
|
|
12398
|
+
_sanitizeDisallowedNode. Run afterSanitizeElements on it so the
|
|
12399
|
+
element-hook lifecycle matches normal allowlisted elements: a
|
|
12400
|
+
security policy applied in this hook (e.g. stripping an attribute
|
|
12401
|
+
from every surviving element) must not silently skip kept custom
|
|
12402
|
+
elements (GHSA-c2j3-45gr-mqc4). This mirrors the normal-element
|
|
12403
|
+
tail below - the hook runs, then the walker's subsequent
|
|
12404
|
+
_sanitizeAttributes pass sanitizes the element's attributes. The
|
|
12405
|
+
deliberately skipped namespace and fallback-tag removal checks stay
|
|
12406
|
+
skipped; they are removal decisions, not the hook contract. */
|
|
12407
|
+
if (removed === false) {
|
|
12408
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
12409
|
+
}
|
|
12410
|
+
return removed;
|
|
12211
12411
|
}
|
|
12212
12412
|
/* Check whether element has a valid namespace.
|
|
12213
12413
|
Realm-safe check (GHSA-hpcv-96wg-7vj8): use the cached Node.prototype
|
|
@@ -12254,6 +12454,33 @@ var purify = {exports: {}};
|
|
|
12254
12454
|
if (FORBID_ATTR[lcName]) {
|
|
12255
12455
|
return false;
|
|
12256
12456
|
}
|
|
12457
|
+
/* Reject declarative-partial-updates patch-linkage attributes
|
|
12458
|
+
(https://github.com/WICG/declarative-partial-updates).
|
|
12459
|
+
Empirical note (Chrome 150, verified — see
|
|
12460
|
+
test/declarative-patch-probe-v3.html): expansion is NOT applied after
|
|
12461
|
+
sanitization. For the string path it fires during sanitize()'s own
|
|
12462
|
+
parse, so the walk sees and sanitizes the fully materialized expanded
|
|
12463
|
+
tree — teleports into MathML/SVG integration points included; a
|
|
12464
|
+
weaponized `<template for>`->`<img onerror>` comes back with the handler
|
|
12465
|
+
stripped. For the IN_PLACE path it fires on connection, before the walk.
|
|
12466
|
+
Either way DOMPurify is NOT blind to the patch.
|
|
12467
|
+
This removal is therefore defense-in-depth rather than the sole barrier:
|
|
12468
|
+
it prevents live linkage from surviving into the OUTPUT and re-expanding
|
|
12469
|
+
in the caller's context, and keeps behaviour deterministic if a future
|
|
12470
|
+
engine defers expansion. `for` is legitimate only on <label>/<output>;
|
|
12471
|
+
anywhere else (notably <template for>) it links the element to a patch
|
|
12472
|
+
target and teleports or removes an arbitrary DOM range by id/marker name.
|
|
12473
|
+
`patchsrc` fetches remote markup and is treated as a script-loading
|
|
12474
|
+
mechanism (CSP). Gated on SAFE_FOR_XML so the removal groups with the
|
|
12475
|
+
other structural-threat checks and stays overridable, consistent with
|
|
12476
|
+
the rest of the codebase. PI range markers are already removed by
|
|
12477
|
+
_isUnsafeNode. */
|
|
12478
|
+
if (SAFE_FOR_XML && lcName === 'patchsrc') {
|
|
12479
|
+
return false;
|
|
12480
|
+
}
|
|
12481
|
+
if (SAFE_FOR_XML && lcName === 'for' && lcTag !== 'label' && lcTag !== 'output') {
|
|
12482
|
+
return false;
|
|
12483
|
+
}
|
|
12257
12484
|
/* Make sure attribute cannot clobber */
|
|
12258
12485
|
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
12259
12486
|
return false;
|
|
@@ -12370,6 +12597,9 @@ var purify = {exports: {}};
|
|
|
12370
12597
|
if (!attributes || _isClobbered(currentNode)) {
|
|
12371
12598
|
return;
|
|
12372
12599
|
}
|
|
12600
|
+
/* Same lazy-install guard as uponSanitizeElement (see there): fork the
|
|
12601
|
+
attribute allowlist off its shared binding before a hook can see it. */
|
|
12602
|
+
ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
|
|
12373
12603
|
const hookEvent = {
|
|
12374
12604
|
attrName: '',
|
|
12375
12605
|
attrValue: '',
|
|
@@ -12463,7 +12693,7 @@ var purify = {exports: {}};
|
|
|
12463
12693
|
/* Execute a hook if present */
|
|
12464
12694
|
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
12465
12695
|
/* Sanitize tags and elements */
|
|
12466
|
-
_sanitizeElements(shadowNode);
|
|
12696
|
+
_sanitizeElements(shadowNode, fragment);
|
|
12467
12697
|
/* Check attributes next */
|
|
12468
12698
|
_sanitizeAttributes(shadowNode);
|
|
12469
12699
|
/* Deep shadow DOM detected.
|
|
@@ -12654,6 +12884,11 @@ var purify = {exports: {}};
|
|
|
12654
12884
|
keep using and whose return value they ignore — unsanitized. REPORT-2. */
|
|
12655
12885
|
const inPlace = IN_PLACE && typeof dirty !== 'string' && _isNode(dirty);
|
|
12656
12886
|
if (inPlace) {
|
|
12887
|
+
/* Declarative-partial-updates / streaming pre-pass: sever every patch
|
|
12888
|
+
linkage across the live tree BEFORE the walk, so no patch can fire
|
|
12889
|
+
mid-walk and inject into an already-processed region. Runs first, so
|
|
12890
|
+
it also covers the forbidden/clobbered roots that throw below. */
|
|
12891
|
+
_neutralizePatchLinkage(dirty);
|
|
12657
12892
|
/* Do some early pre-sanitization to avoid unsafe root nodes.
|
|
12658
12893
|
Read nodeName through the cached prototype getter — a clobbering
|
|
12659
12894
|
child named "nodeName" on the form root would otherwise shadow
|
|
@@ -12663,6 +12898,9 @@ var purify = {exports: {}};
|
|
|
12663
12898
|
if (typeof nn === 'string') {
|
|
12664
12899
|
const tagName = transformCaseFunc(nn);
|
|
12665
12900
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
12901
|
+
/* Fail closed on a live root: neutralize handlers/children before
|
|
12902
|
+
throwing, exactly as the mid-walk abort path does. */
|
|
12903
|
+
_neutralizeRoot(dirty);
|
|
12666
12904
|
throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
|
|
12667
12905
|
}
|
|
12668
12906
|
}
|
|
@@ -12677,6 +12915,10 @@ var purify = {exports: {}};
|
|
|
12677
12915
|
the application unsanitized. Refuse to sanitize such a root
|
|
12678
12916
|
the same way we refuse a forbidden tag. GHSA-r47g-fvhr-h676. */
|
|
12679
12917
|
if (_isClobbered(dirty)) {
|
|
12918
|
+
/* Fail closed on a live clobbered root before throwing.
|
|
12919
|
+
_neutralizeRoot's reads are clobber-safe (cached getters); the
|
|
12920
|
+
form's non-clobbered descendants, e.g. an armed <img>, are scrubbed. */
|
|
12921
|
+
_neutralizeRoot(dirty);
|
|
12680
12922
|
throw typeErrorCreate('root node is clobbered and cannot be sanitized in-place');
|
|
12681
12923
|
}
|
|
12682
12924
|
/* Sanitize attached shadow roots before the main iterator runs.
|
|
@@ -12729,20 +12971,24 @@ var purify = {exports: {}};
|
|
|
12729
12971
|
_forceRemove(body.firstChild);
|
|
12730
12972
|
}
|
|
12731
12973
|
/* Get node iterator */
|
|
12732
|
-
const
|
|
12974
|
+
const walkRoot = inPlace ? dirty : body;
|
|
12733
12975
|
/* Now start iterating over the created document.
|
|
12734
12976
|
The walk runs inside an exception barrier (campaign-3 F2): a re-entrant
|
|
12735
12977
|
engine/custom-element mutation can detach a node mid-walk so
|
|
12736
12978
|
`_forceRemove`'s parentless guard throws, aborting the loop. Without the
|
|
12737
12979
|
barrier the caller's in-place tree would be left half-sanitized with the
|
|
12738
|
-
unvisited tail still armed.
|
|
12739
|
-
|
|
12740
|
-
|
|
12741
|
-
|
|
12980
|
+
unvisited tail still armed. _createNodeIterator itself is inside the
|
|
12981
|
+
barrier too: constructing the iterator dereferences the root's document,
|
|
12982
|
+
and any failure there (e.g. an exotic/clobbered root) must still fail
|
|
12983
|
+
closed rather than skip the neutralize. On any throw we fail closed -
|
|
12984
|
+
strip the in-place root bare - then rethrow so the existing throw
|
|
12985
|
+
contract is preserved. (String/DOM-copy paths never return the partial
|
|
12986
|
+
body, so the propagating throw is already fail-closed there.) */
|
|
12742
12987
|
try {
|
|
12988
|
+
const nodeIterator = _createNodeIterator(walkRoot);
|
|
12743
12989
|
while (currentNode = nodeIterator.nextNode()) {
|
|
12744
12990
|
/* Sanitize tags and elements */
|
|
12745
|
-
_sanitizeElements(currentNode);
|
|
12991
|
+
_sanitizeElements(currentNode, walkRoot);
|
|
12746
12992
|
/* Check attributes next */
|
|
12747
12993
|
_sanitizeAttributes(currentNode);
|
|
12748
12994
|
/* Shadow DOM detected, sanitize it.
|
|
@@ -12756,6 +13002,14 @@ var purify = {exports: {}};
|
|
|
12756
13002
|
} catch (error) {
|
|
12757
13003
|
if (inPlace) {
|
|
12758
13004
|
_neutralizeRoot(dirty);
|
|
13005
|
+
/* Nodes _forceRemove'd earlier in the aborted walk are already
|
|
13006
|
+
detached from the root, so _neutralizeRoot's subtree pass does not
|
|
13007
|
+
reach them. Defuse them too, mirroring the success-path loop below. */
|
|
13008
|
+
arrayForEach(DOMPurify.removed, entry => {
|
|
13009
|
+
if (entry.element) {
|
|
13010
|
+
_neutralizeSubtree(entry.element);
|
|
13011
|
+
}
|
|
13012
|
+
});
|
|
12759
13013
|
}
|
|
12760
13014
|
throw error;
|
|
12761
13015
|
}
|
|
@@ -14221,11 +14475,14 @@ class NavigationButton {
|
|
|
14221
14475
|
*/
|
|
14222
14476
|
this.hostMutationCallback = (mutationList) => {
|
|
14223
14477
|
mutationList.forEach(({ attributeName }) => {
|
|
14224
|
-
if (attributeName) {
|
|
14478
|
+
if (attributeName && MUTABLE_ATTRIBUTES$2.includes(attributeName)) {
|
|
14225
14479
|
const attribute = this.el.getAttribute(attributeName);
|
|
14226
|
-
if (attribute
|
|
14480
|
+
if (attribute) {
|
|
14227
14481
|
this.inheritedAttributes[attributeName] = attribute;
|
|
14228
14482
|
}
|
|
14483
|
+
else {
|
|
14484
|
+
delete this.inheritedAttributes[attributeName];
|
|
14485
|
+
}
|
|
14229
14486
|
}
|
|
14230
14487
|
});
|
|
14231
14488
|
};
|
|
@@ -14289,11 +14546,11 @@ class NavigationButton {
|
|
|
14289
14546
|
target,
|
|
14290
14547
|
theme,
|
|
14291
14548
|
};
|
|
14292
|
-
return (hAsync(Host, { key: '
|
|
14549
|
+
return (hAsync(Host, { key: 'dd30f288d728c8e8dffd4108d05e0a02b782d9ea', class: {
|
|
14293
14550
|
"in-side-menu": isMenuMode,
|
|
14294
14551
|
[`ic-theme-${theme}`]: theme !== "inherit",
|
|
14295
14552
|
dark: parentThemeDark,
|
|
14296
|
-
} }, hAsync("ic-button", Object.assign({ key: '
|
|
14553
|
+
} }, hAsync("ic-button", Object.assign({ key: 'b59e4538abe478aa21617a1ce3347668c3859e40', ref: (el) => (this.buttonEl = el), class: { "popout-menu-button": isMenuMode }, "aria-label": !isMenuMode ? label : null, disableTooltip: isMenuMode, fullWidth: isMenuMode, monochrome: !isMenuMode, size: isMenuMode ? "medium" : "large", variant: isMenuMode ? "tertiary" : "icon-tertiary" }, buttonProps, inheritedAttributes), isMenuMode ? label : "", hAsync("slot", { key: '4ca3226dd11288f30f595d8b0fa8484838b527c4', slot: "left-icon", name: "icon" }), isSlotUsed(this.el, "badge") && hAsync("slot", { key: '89408c559f0b62b9f92686bbc14a5312f8e6c2c6', name: "badge" }))));
|
|
14297
14554
|
}
|
|
14298
14555
|
static get delegatesFocus() { return true; }
|
|
14299
14556
|
get el() { return getElement(this); }
|