@knime/kds-components 10.0.0 → 10.2.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/CHANGELOG.md +19 -0
- package/dist/index.css +39 -25
- package/dist/index.js +337 -91
- package/dist/index.js.map +1 -1
- package/dist/src/components/forms/ToggleSwitch/KdsToggleSwitch.vue.d.ts.map +1 -1
- package/dist/src/components/forms/ToggleSwitch/enums.d.ts +2 -1
- package/dist/src/components/forms/ToggleSwitch/enums.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -4931,6 +4931,14 @@ var dimension = {
|
|
|
4931
4931
|
variable: "var(--kds-dimension-component-height-0-25x)"
|
|
4932
4932
|
}
|
|
4933
4933
|
},
|
|
4934
|
+
"0.5x": {
|
|
4935
|
+
value: 8,
|
|
4936
|
+
unit: "px",
|
|
4937
|
+
css: {
|
|
4938
|
+
value: "8px",
|
|
4939
|
+
variable: "var(--kds-dimension-component-height-0-5x)"
|
|
4940
|
+
}
|
|
4941
|
+
},
|
|
4934
4942
|
"0.75x": {
|
|
4935
4943
|
value: 12,
|
|
4936
4944
|
unit: "px",
|
|
@@ -5077,6 +5085,14 @@ var dimension = {
|
|
|
5077
5085
|
variable: "var(--kds-dimension-component-width-0-25x)"
|
|
5078
5086
|
}
|
|
5079
5087
|
},
|
|
5088
|
+
"0.5x": {
|
|
5089
|
+
value: 8,
|
|
5090
|
+
unit: "px",
|
|
5091
|
+
css: {
|
|
5092
|
+
value: "8px",
|
|
5093
|
+
variable: "var(--kds-dimension-component-width-0-5x)"
|
|
5094
|
+
}
|
|
5095
|
+
},
|
|
5080
5096
|
"0.75x": {
|
|
5081
5097
|
value: 12,
|
|
5082
5098
|
unit: "px",
|
|
@@ -6985,8 +7001,11 @@ function prettyBytes(number, options) {
|
|
|
6985
7001
|
return applyFixedWidth(result, options.fixedWidth);
|
|
6986
7002
|
}
|
|
6987
7003
|
//#endregion
|
|
6988
|
-
//#region ../../node_modules/.pnpm/dompurify@3.4.
|
|
6989
|
-
/*! @license DOMPurify 3.4.
|
|
7004
|
+
//#region ../../node_modules/.pnpm/dompurify@3.4.16/node_modules/dompurify/dist/purify.es.mjs
|
|
7005
|
+
/*! @license DOMPurify 3.4.16 | (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.16/LICENSE */
|
|
7006
|
+
function _OverloadYield(e, d) {
|
|
7007
|
+
this.v = e, this.k = d;
|
|
7008
|
+
}
|
|
6990
7009
|
function _arrayLikeToArray(r, a) {
|
|
6991
7010
|
(null == a || a > r.length) && (a = r.length);
|
|
6992
7011
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -6998,12 +7017,14 @@ function _arrayWithHoles(r) {
|
|
|
6998
7017
|
function _iterableToArrayLimit(r, l) {
|
|
6999
7018
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
7000
7019
|
if (null != t) {
|
|
7001
|
-
var e, n, i, u, a = [], f =
|
|
7020
|
+
var e, n, i, u, a = [], f = !0, o = !1;
|
|
7002
7021
|
try {
|
|
7003
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
7004
|
-
|
|
7022
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
7023
|
+
if (Object(t) !== t) return;
|
|
7024
|
+
f = !1;
|
|
7025
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
7005
7026
|
} catch (r) {
|
|
7006
|
-
o =
|
|
7027
|
+
o = !0, n = r;
|
|
7007
7028
|
} finally {
|
|
7008
7029
|
try {
|
|
7009
7030
|
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
@@ -7017,6 +7038,7 @@ function _iterableToArrayLimit(r, l) {
|
|
|
7017
7038
|
function _nonIterableRest() {
|
|
7018
7039
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7019
7040
|
}
|
|
7041
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
7020
7042
|
function _slicedToArray(r, e) {
|
|
7021
7043
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
7022
7044
|
}
|
|
@@ -7027,9 +7049,64 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
7027
7049
|
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;
|
|
7028
7050
|
}
|
|
7029
7051
|
}
|
|
7030
|
-
|
|
7031
|
-
var
|
|
7032
|
-
|
|
7052
|
+
function AsyncGenerator(e) {
|
|
7053
|
+
var t, n;
|
|
7054
|
+
function resume(t, n) {
|
|
7055
|
+
try {
|
|
7056
|
+
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
|
|
7057
|
+
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
7058
|
+
if (u) {
|
|
7059
|
+
var i = "return" === t && o.k ? t : "next";
|
|
7060
|
+
if (!o.k || n.done) return resume(i, n);
|
|
7061
|
+
n = e[i](n).value;
|
|
7062
|
+
}
|
|
7063
|
+
settle(!!r.done, n);
|
|
7064
|
+
}, function(e) {
|
|
7065
|
+
resume("throw", e);
|
|
7066
|
+
});
|
|
7067
|
+
} catch (e) {
|
|
7068
|
+
settle(2, e);
|
|
7069
|
+
}
|
|
7070
|
+
}
|
|
7071
|
+
function settle(e, r) {
|
|
7072
|
+
2 === e ? t.reject(r) : t.resolve({
|
|
7073
|
+
value: r,
|
|
7074
|
+
done: e
|
|
7075
|
+
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
7076
|
+
}
|
|
7077
|
+
this._invoke = function(e, r) {
|
|
7078
|
+
return new Promise(function(o, u) {
|
|
7079
|
+
var i = {
|
|
7080
|
+
key: e,
|
|
7081
|
+
arg: r,
|
|
7082
|
+
resolve: o,
|
|
7083
|
+
reject: u,
|
|
7084
|
+
next: null
|
|
7085
|
+
};
|
|
7086
|
+
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
7087
|
+
});
|
|
7088
|
+
}, "function" != typeof e.return && (this.return = void 0);
|
|
7089
|
+
}
|
|
7090
|
+
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
7091
|
+
return this;
|
|
7092
|
+
}, AsyncGenerator.prototype.next = function(e) {
|
|
7093
|
+
return this._invoke("next", e);
|
|
7094
|
+
}, AsyncGenerator.prototype.throw = function(e) {
|
|
7095
|
+
return this._invoke("throw", e);
|
|
7096
|
+
}, AsyncGenerator.prototype.return = function(e) {
|
|
7097
|
+
return this._invoke("return", e);
|
|
7098
|
+
};
|
|
7099
|
+
var entries = Object.entries;
|
|
7100
|
+
var setPrototypeOf = Object.setPrototypeOf;
|
|
7101
|
+
var isFrozen = Object.isFrozen;
|
|
7102
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
7103
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
7104
|
+
var freeze = Object.freeze;
|
|
7105
|
+
var seal = Object.seal;
|
|
7106
|
+
var create$1 = Object.create;
|
|
7107
|
+
var _ref = typeof Reflect !== "undefined" && Reflect;
|
|
7108
|
+
var apply = _ref.apply;
|
|
7109
|
+
var construct = _ref.construct;
|
|
7033
7110
|
if (!freeze) freeze = function freeze(x) {
|
|
7034
7111
|
return x;
|
|
7035
7112
|
};
|
|
@@ -7045,9 +7122,11 @@ if (!construct) construct = function construct(Func) {
|
|
|
7045
7122
|
return new Func(...args);
|
|
7046
7123
|
};
|
|
7047
7124
|
var arrayForEach = unapply(Array.prototype.forEach);
|
|
7125
|
+
Array.prototype.indexOf;
|
|
7048
7126
|
var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
7049
7127
|
var arrayPop = unapply(Array.prototype.pop);
|
|
7050
7128
|
var arrayPush = unapply(Array.prototype.push);
|
|
7129
|
+
Array.prototype.slice;
|
|
7051
7130
|
var arraySplice = unapply(Array.prototype.splice);
|
|
7052
7131
|
var arrayIsArray = Array.isArray;
|
|
7053
7132
|
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
@@ -7707,6 +7786,7 @@ var svg = freeze([
|
|
|
7707
7786
|
"patterncontentunits",
|
|
7708
7787
|
"patterntransform",
|
|
7709
7788
|
"patternunits",
|
|
7789
|
+
"pointer-events",
|
|
7710
7790
|
"points",
|
|
7711
7791
|
"preservealpha",
|
|
7712
7792
|
"preserveaspectratio",
|
|
@@ -7761,6 +7841,7 @@ var svg = freeze([
|
|
|
7761
7841
|
"u2",
|
|
7762
7842
|
"unicode",
|
|
7763
7843
|
"values",
|
|
7844
|
+
"vector-effect",
|
|
7764
7845
|
"viewbox",
|
|
7765
7846
|
"visibility",
|
|
7766
7847
|
"version",
|
|
@@ -7874,6 +7955,24 @@ var NODE_TYPE = {
|
|
|
7874
7955
|
documentFragment: 11,
|
|
7875
7956
|
notation: 12
|
|
7876
7957
|
};
|
|
7958
|
+
var LITERAL_TEXT_ELEMENT_NAMES = [
|
|
7959
|
+
"style",
|
|
7960
|
+
"script",
|
|
7961
|
+
"xmp",
|
|
7962
|
+
"iframe",
|
|
7963
|
+
"noembed",
|
|
7964
|
+
"noframes",
|
|
7965
|
+
"plaintext",
|
|
7966
|
+
"noscript"
|
|
7967
|
+
];
|
|
7968
|
+
var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
|
|
7969
|
+
var LITERAL_TEXT_CLOSE = function() {
|
|
7970
|
+
const map = {};
|
|
7971
|
+
arrayForEach(LITERAL_TEXT_ELEMENT_NAMES, (name) => {
|
|
7972
|
+
map[name] = seal(new RegExp("</" + name + "(?=[\\t\\n\\f\\r />])", "i"));
|
|
7973
|
+
});
|
|
7974
|
+
return freeze(map);
|
|
7975
|
+
}();
|
|
7877
7976
|
var getGlobal = function getGlobal() {
|
|
7878
7977
|
return typeof window === "undefined" ? null : window;
|
|
7879
7978
|
};
|
|
@@ -7933,10 +8032,25 @@ var _createHooksMap = function _createHooksMap() {
|
|
|
7933
8032
|
var _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
|
|
7934
8033
|
return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
|
|
7935
8034
|
};
|
|
8035
|
+
/**
|
|
8036
|
+
* Resolve an object-valued configuration option: a prototype-free clone
|
|
8037
|
+
* of cfg[key] when it is an own, truthy object property, else a fresh
|
|
8038
|
+
* fallback built by makeFallback (fresh on every parse, so a previous
|
|
8039
|
+
* parse can never leak state into the next one).
|
|
8040
|
+
*
|
|
8041
|
+
* @param cfg the cloned, prototype-free configuration object
|
|
8042
|
+
* @param key the configuration property to read
|
|
8043
|
+
* @param makeFallback builds the fallback value when the option is absent
|
|
8044
|
+
* @returns the resolved object
|
|
8045
|
+
*/
|
|
8046
|
+
var _resolveObjectOption = function _resolveObjectOption(cfg, key, makeFallback) {
|
|
8047
|
+
const value = objectHasOwnProperty(cfg, key) ? cfg[key] : void 0;
|
|
8048
|
+
return value && typeof value === "object" ? clone(value) : makeFallback();
|
|
8049
|
+
};
|
|
7936
8050
|
function createDOMPurify() {
|
|
7937
8051
|
let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
7938
8052
|
const DOMPurify = (root) => createDOMPurify(root);
|
|
7939
|
-
DOMPurify.version = "3.4.
|
|
8053
|
+
DOMPurify.version = "3.4.16";
|
|
7940
8054
|
DOMPurify.removed = [];
|
|
7941
8055
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
7942
8056
|
DOMPurify.isSupported = false;
|
|
@@ -7953,6 +8067,7 @@ function createDOMPurify() {
|
|
|
7953
8067
|
const ElementPrototype = Element.prototype;
|
|
7954
8068
|
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
|
7955
8069
|
const remove = lookupGetter(ElementPrototype, "remove");
|
|
8070
|
+
const removeAttributeNode = lookupGetter(ElementPrototype, "removeAttributeNode");
|
|
7956
8071
|
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
7957
8072
|
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
7958
8073
|
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
@@ -7961,6 +8076,12 @@ function createDOMPurify() {
|
|
|
7961
8076
|
const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
|
|
7962
8077
|
const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
|
|
7963
8078
|
const getOwnerDocument = Node && Node.prototype ? lookupGetter(Node.prototype, "ownerDocument") : null;
|
|
8079
|
+
const _readNodeType = function _readNodeType(node) {
|
|
8080
|
+
return getNodeType ? getNodeType(node) : node.nodeType;
|
|
8081
|
+
};
|
|
8082
|
+
const _readNodeName = function _readNodeName(node) {
|
|
8083
|
+
return getNodeName ? getNodeName(node) : node.nodeName;
|
|
8084
|
+
};
|
|
7964
8085
|
if (typeof HTMLTemplateElement === "function") {
|
|
7965
8086
|
const template = document.createElement("template");
|
|
7966
8087
|
if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
|
|
@@ -8218,9 +8339,9 @@ function createDOMPurify() {
|
|
|
8218
8339
|
IN_PLACE = cfg.IN_PLACE || false;
|
|
8219
8340
|
IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
|
|
8220
8341
|
NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
|
|
8221
|
-
MATHML_TEXT_INTEGRATION_POINTS =
|
|
8222
|
-
HTML_INTEGRATION_POINTS =
|
|
8223
|
-
const customElementHandling =
|
|
8342
|
+
MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(cfg, "MATHML_TEXT_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS));
|
|
8343
|
+
HTML_INTEGRATION_POINTS = _resolveObjectOption(cfg, "HTML_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS));
|
|
8344
|
+
const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create$1(null));
|
|
8224
8345
|
CUSTOM_ELEMENT_HANDLING = create$1(null);
|
|
8225
8346
|
if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
|
|
8226
8347
|
if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
|
|
@@ -8267,11 +8388,6 @@ function createDOMPurify() {
|
|
|
8267
8388
|
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
8268
8389
|
}
|
|
8269
8390
|
}
|
|
8270
|
-
if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
8271
|
-
if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
|
|
8272
|
-
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
8273
|
-
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
8274
|
-
}
|
|
8275
8391
|
if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
|
|
8276
8392
|
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
8277
8393
|
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
@@ -8388,6 +8504,32 @@ function createDOMPurify() {
|
|
|
8388
8504
|
}
|
|
8389
8505
|
};
|
|
8390
8506
|
/**
|
|
8507
|
+
* _stripAttributeNode
|
|
8508
|
+
*
|
|
8509
|
+
* Remove a single Attr node case/namespace-exactly on an attribute-teardown
|
|
8510
|
+
* path. Name-based removeAttribute() ASCII-lowercases its lookup key for an
|
|
8511
|
+
* HTML element in an HTML document and so silently misses a case-preserved
|
|
8512
|
+
* handler (e.g. `ONERROR` off an XML/XHTML import) - the same defect
|
|
8513
|
+
* _removeAttribute() was fixed for, which a name-based call would reintroduce
|
|
8514
|
+
* on these IN_PLACE teardown paths. Unlike _removeAttribute this does not
|
|
8515
|
+
* record into DOMPurify.removed: the neutralize passes intentionally do not
|
|
8516
|
+
* book-keep. A clobbered/detached node falls back to best-effort name-based
|
|
8517
|
+
* removal.
|
|
8518
|
+
*
|
|
8519
|
+
* @param element the element to strip the attribute from
|
|
8520
|
+
* @param attribute the Attr node to remove
|
|
8521
|
+
* @param name the attribute's name, for the fallback path
|
|
8522
|
+
*/
|
|
8523
|
+
const _stripAttributeNode = function _stripAttributeNode(element, attribute, name) {
|
|
8524
|
+
try {
|
|
8525
|
+
removeAttributeNode(element, attribute);
|
|
8526
|
+
} catch (_) {
|
|
8527
|
+
try {
|
|
8528
|
+
element.removeAttribute(name);
|
|
8529
|
+
} catch (_) {}
|
|
8530
|
+
}
|
|
8531
|
+
};
|
|
8532
|
+
/**
|
|
8391
8533
|
* _neutralizeRoot
|
|
8392
8534
|
*
|
|
8393
8535
|
* Fail-closed teardown of an in-place root after the sanitize walk aborts
|
|
@@ -8421,30 +8563,45 @@ function createDOMPurify() {
|
|
|
8421
8563
|
if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
|
|
8422
8564
|
const attribute = attributes[i];
|
|
8423
8565
|
const name = attribute && attribute.name;
|
|
8424
|
-
if (typeof name === "string")
|
|
8425
|
-
root.removeAttribute(name);
|
|
8426
|
-
} catch (_) {}
|
|
8566
|
+
if (typeof name === "string") _stripAttributeNode(root, attribute, name);
|
|
8427
8567
|
}
|
|
8428
8568
|
};
|
|
8429
8569
|
/**
|
|
8430
8570
|
* _removeAttribute
|
|
8431
8571
|
*
|
|
8572
|
+
* Name-based getAttributeNode()/removeAttribute() ASCII-lowercase their
|
|
8573
|
+
* lookup key for HTML elements in an HTML document, so they silently miss an
|
|
8574
|
+
* attribute whose stored qualified name still contains uppercase ASCII
|
|
8575
|
+
* letters. That happens when the node came from a case-preserving source
|
|
8576
|
+
* (an XML/XHTML document imported via importNode(), or createAttributeNS()),
|
|
8577
|
+
* where e.g. `ONERROR` survives the walk: the policy check lowercases to
|
|
8578
|
+
* `onerror` and rejects it, but `removeAttribute('ONERROR')` looks up
|
|
8579
|
+
* `onerror` and finds nothing. Remove the exact Attr node instead, which is
|
|
8580
|
+
* case- and namespace-exact, and fall back to name-based removal only when
|
|
8581
|
+
* the caller could not supply the node.
|
|
8582
|
+
*
|
|
8432
8583
|
* @param name an Attribute name
|
|
8433
8584
|
* @param element a DOM node
|
|
8585
|
+
* @param attr the exact Attr node to remove, when the caller has it
|
|
8434
8586
|
*/
|
|
8435
|
-
const _removeAttribute = function _removeAttribute(name, element) {
|
|
8587
|
+
const _removeAttribute = function _removeAttribute(name, element, attr) {
|
|
8588
|
+
if (!attr) try {
|
|
8589
|
+
attr = element.getAttributeNode(name);
|
|
8590
|
+
} catch (_) {
|
|
8591
|
+
attr = null;
|
|
8592
|
+
}
|
|
8593
|
+
arrayPush(DOMPurify.removed, {
|
|
8594
|
+
attribute: attr || null,
|
|
8595
|
+
from: element
|
|
8596
|
+
});
|
|
8436
8597
|
try {
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
from: element
|
|
8440
|
-
});
|
|
8598
|
+
if (attr) removeAttributeNode(element, attr);
|
|
8599
|
+
else element.removeAttribute(name);
|
|
8441
8600
|
} catch (_) {
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
});
|
|
8601
|
+
try {
|
|
8602
|
+
element.removeAttribute(name);
|
|
8603
|
+
} catch (_) {}
|
|
8446
8604
|
}
|
|
8447
|
-
element.removeAttribute(name);
|
|
8448
8605
|
if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
|
|
8449
8606
|
_forceRemove(element);
|
|
8450
8607
|
} catch (_) {}
|
|
@@ -8469,9 +8626,7 @@ function createDOMPurify() {
|
|
|
8469
8626
|
const attribute = attributes[i];
|
|
8470
8627
|
const name = attribute && attribute.name;
|
|
8471
8628
|
if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) continue;
|
|
8472
|
-
|
|
8473
|
-
element.removeAttribute(name);
|
|
8474
|
-
} catch (_) {}
|
|
8629
|
+
_stripAttributeNode(element, attribute, name);
|
|
8475
8630
|
}
|
|
8476
8631
|
};
|
|
8477
8632
|
/**
|
|
@@ -8500,7 +8655,7 @@ function createDOMPurify() {
|
|
|
8500
8655
|
const stack = [root];
|
|
8501
8656
|
while (stack.length > 0) {
|
|
8502
8657
|
const node = stack.pop();
|
|
8503
|
-
if ((
|
|
8658
|
+
if (_readNodeType(node) === NODE_TYPE.element) _stripDisallowedAttributes(node);
|
|
8504
8659
|
const childNodes = getChildNodes(node);
|
|
8505
8660
|
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
8506
8661
|
}
|
|
@@ -8540,12 +8695,28 @@ function createDOMPurify() {
|
|
|
8540
8695
|
*
|
|
8541
8696
|
* @param root the in-place root to sweep
|
|
8542
8697
|
*/
|
|
8698
|
+
/**
|
|
8699
|
+
* Central policy for declarative-partial-updates patch-linkage attributes,
|
|
8700
|
+
* shared by the _neutralizePatchLinkage pre-pass and _isValidAttribute so
|
|
8701
|
+
* the two sites cannot drift: `patchsrc` always links, `for` links
|
|
8702
|
+
* everywhere except on <label>/<output>, and the whole policy is gated on
|
|
8703
|
+
* SAFE_FOR_XML (see the rationale block in _isValidAttribute).
|
|
8704
|
+
*
|
|
8705
|
+
* @param lcName the transformCaseFunc'd attribute name
|
|
8706
|
+
* @param lcTag the transformCaseFunc'd tag name of the carrying element
|
|
8707
|
+
* @return true if the attribute is patch linkage and must be dropped
|
|
8708
|
+
*/
|
|
8709
|
+
const _isPatchLinkageAttribute = function _isPatchLinkageAttribute(lcName, lcTag) {
|
|
8710
|
+
if (!SAFE_FOR_XML) return false;
|
|
8711
|
+
if (lcName === "patchsrc") return true;
|
|
8712
|
+
return lcName === "for" && lcTag !== "label" && lcTag !== "output";
|
|
8713
|
+
};
|
|
8543
8714
|
const _neutralizePatchLinkage = function _neutralizePatchLinkage(root) {
|
|
8544
8715
|
if (!SAFE_FOR_XML) return;
|
|
8545
8716
|
const stack = [root];
|
|
8546
8717
|
while (stack.length > 0) {
|
|
8547
8718
|
const node = stack.pop();
|
|
8548
|
-
const nodeType =
|
|
8719
|
+
const nodeType = _readNodeType(node);
|
|
8549
8720
|
if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
|
|
8550
8721
|
try {
|
|
8551
8722
|
remove(node);
|
|
@@ -8554,10 +8725,10 @@ function createDOMPurify() {
|
|
|
8554
8725
|
}
|
|
8555
8726
|
if (nodeType === NODE_TYPE.element) {
|
|
8556
8727
|
const element = node;
|
|
8557
|
-
const lcTag = transformCaseFunc(
|
|
8728
|
+
const lcTag = transformCaseFunc(_readNodeName(node));
|
|
8558
8729
|
try {
|
|
8559
8730
|
if (element.hasAttribute && element.hasAttribute("patchsrc")) element.removeAttribute("patchsrc");
|
|
8560
|
-
if (element.hasAttribute && element.hasAttribute("for") &&
|
|
8731
|
+
if (element.hasAttribute && element.hasAttribute("for") && _isPatchLinkageAttribute("for", lcTag)) element.removeAttribute("for");
|
|
8561
8732
|
} catch (_) {}
|
|
8562
8733
|
}
|
|
8563
8734
|
const childNodes = getChildNodes(node);
|
|
@@ -8668,7 +8839,7 @@ function createDOMPurify() {
|
|
|
8668
8839
|
const realTagName = getNodeName ? getNodeName(element) : null;
|
|
8669
8840
|
if (typeof realTagName !== "string") return false;
|
|
8670
8841
|
if (transformCaseFunc(realTagName) !== "form") return false;
|
|
8671
|
-
return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
|
|
8842
|
+
return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.removeAttributeNode !== "function" || typeof element.getAttributeNode !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
|
|
8672
8843
|
};
|
|
8673
8844
|
/**
|
|
8674
8845
|
* Checks whether the given value is a DocumentFragment from any realm.
|
|
@@ -8726,12 +8897,32 @@ function createDOMPurify() {
|
|
|
8726
8897
|
*/
|
|
8727
8898
|
const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
|
|
8728
8899
|
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
|
|
8729
|
-
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "
|
|
8900
|
+
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && LITERAL_TEXT_ELEMENTS[tagName] && (_isNode(currentNode.firstElementChild) || typeof currentNode.textContent === "string" && regExpTest(LITERAL_TEXT_CLOSE[tagName], currentNode.textContent))) return true;
|
|
8730
8901
|
if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
|
|
8731
8902
|
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
|
|
8732
8903
|
return false;
|
|
8733
8904
|
};
|
|
8734
8905
|
/**
|
|
8906
|
+
* Evaluate a CUSTOM_ELEMENT_HANDLING check (a RegExp or a predicate
|
|
8907
|
+
* function, per the validation in _parseConfig) against a name.
|
|
8908
|
+
* Additional arguments are forwarded to predicate functions - the
|
|
8909
|
+
* attributeNameCheck predicate receives the tag name as its second
|
|
8910
|
+
* argument. A null/absent check never matches.
|
|
8911
|
+
*
|
|
8912
|
+
* @param check the configured tagNameCheck / attributeNameCheck value
|
|
8913
|
+
* @param name the name to test
|
|
8914
|
+
* @param args extra arguments forwarded to a predicate function
|
|
8915
|
+
* @return true if the check matches the name
|
|
8916
|
+
*/
|
|
8917
|
+
const _matchesNameCheck = function _matchesNameCheck(check, name) {
|
|
8918
|
+
if (check instanceof RegExp) return regExpTest(check, name);
|
|
8919
|
+
if (check instanceof Function) {
|
|
8920
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
|
8921
|
+
return Boolean(check(name, ...args));
|
|
8922
|
+
}
|
|
8923
|
+
return false;
|
|
8924
|
+
};
|
|
8925
|
+
/**
|
|
8735
8926
|
* Handle a node whose tag is forbidden or not allowlisted: keep
|
|
8736
8927
|
* allowed custom elements (false return exits _sanitizeElements
|
|
8737
8928
|
* early - the namespace and fallback-tag removal checks are
|
|
@@ -8749,10 +8940,7 @@ function createDOMPurify() {
|
|
|
8749
8940
|
* @return true if the node was removed, false if kept
|
|
8750
8941
|
*/
|
|
8751
8942
|
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName, root) {
|
|
8752
|
-
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName))
|
|
8753
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
8754
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
|
|
8755
|
-
}
|
|
8943
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
8756
8944
|
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
8757
8945
|
const parentNode = getParentNode(currentNode);
|
|
8758
8946
|
const childNodes = getChildNodes(currentNode);
|
|
@@ -8786,6 +8974,42 @@ function createDOMPurify() {
|
|
|
8786
8974
|
return set === defaultSet || set === setConfigSet ? clone(set) : set;
|
|
8787
8975
|
};
|
|
8788
8976
|
/**
|
|
8977
|
+
* Shared guard for a node that a hook has detached from the walk tree,
|
|
8978
|
+
* used after each element-hook site in _sanitizeElements. Detaching is a
|
|
8979
|
+
* long-standing user pattern (issue #469; draw.io-style foreignObject
|
|
8980
|
+
* filtering). Per the cached, unclobberable parentNode getter the node is
|
|
8981
|
+
* genuinely out of the tree, so it can reach neither the serialized
|
|
8982
|
+
* output nor an IN_PLACE live tree; treat it as removed and stop
|
|
8983
|
+
* processing it. Without this guard, the unsafe-node / namespace checks
|
|
8984
|
+
* would call _forceRemove on a parentless node and hit the REPORT-3
|
|
8985
|
+
* fail-closed throw — which exists for nodes DOMPurify wants gone but
|
|
8986
|
+
* *cannot* detach (clobbered / parentless roots), the opposite of a node
|
|
8987
|
+
* that is already safely gone. The walk root is exempt: a detached
|
|
8988
|
+
* IN_PLACE root is legitimate input and must still be fully sanitized,
|
|
8989
|
+
* and a kill-decision on it must keep hitting the REPORT-3 throw.
|
|
8990
|
+
*
|
|
8991
|
+
* Nodes detached by hooks stay the hook's responsibility for placement:
|
|
8992
|
+
* they are not recorded in DOMPurify.removed, so the post-walk IN_PLACE
|
|
8993
|
+
* pass (which iterates DOMPurify.removed) does not reach them. But a
|
|
8994
|
+
* hook-detached subtree can still hold a queued resource-event handler -
|
|
8995
|
+
* e.g. an <img onload> that began loading when the caller built the live
|
|
8996
|
+
* tree - which fires in page scope after sanitize returns even though the
|
|
8997
|
+
* handler never reached the returned tree. That is the audit-5 F1 hazard,
|
|
8998
|
+
* and the documented node.remove() hook pattern walks straight into it.
|
|
8999
|
+
* So on the IN_PLACE path we neutralize the detached subtree inline,
|
|
9000
|
+
* stripping its non-allow-listed attributes before returning, exactly as
|
|
9001
|
+
* the post-walk pass does for _forceRemove'd subtrees.
|
|
9002
|
+
*
|
|
9003
|
+
* @param currentNode the node a hook may have detached
|
|
9004
|
+
* @param root the current walk root
|
|
9005
|
+
* @return true if the node is detached and now handled, false otherwise
|
|
9006
|
+
*/
|
|
9007
|
+
const _handleHookDetachedNode = function _handleHookDetachedNode(currentNode, root) {
|
|
9008
|
+
if (currentNode === root || getParentNode(currentNode) !== null) return false;
|
|
9009
|
+
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
9010
|
+
return true;
|
|
9011
|
+
};
|
|
9012
|
+
/**
|
|
8789
9013
|
* _sanitizeElements
|
|
8790
9014
|
*
|
|
8791
9015
|
* @protect nodeName
|
|
@@ -8796,34 +9020,31 @@ function createDOMPurify() {
|
|
|
8796
9020
|
*/
|
|
8797
9021
|
const _sanitizeElements = function _sanitizeElements(currentNode, root) {
|
|
8798
9022
|
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
8799
|
-
if (currentNode
|
|
8800
|
-
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
8801
|
-
return true;
|
|
8802
|
-
}
|
|
9023
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
8803
9024
|
if (_isClobbered(currentNode)) {
|
|
8804
9025
|
_forceRemove(currentNode);
|
|
8805
9026
|
return true;
|
|
8806
9027
|
}
|
|
8807
|
-
const tagName = transformCaseFunc(
|
|
9028
|
+
const tagName = transformCaseFunc(_readNodeName(currentNode));
|
|
8808
9029
|
ALLOWED_TAGS = _forkSharedAllowlist(hooks.uponSanitizeElement, ALLOWED_TAGS, DEFAULT_ALLOWED_TAGS, SET_CONFIG_ALLOWED_TAGS);
|
|
8809
9030
|
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
8810
9031
|
tagName,
|
|
8811
9032
|
allowedTags: ALLOWED_TAGS
|
|
8812
9033
|
});
|
|
8813
|
-
if (currentNode
|
|
8814
|
-
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
8815
|
-
return true;
|
|
8816
|
-
}
|
|
9034
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
8817
9035
|
if (_isUnsafeNode(currentNode, tagName)) {
|
|
8818
9036
|
_forceRemove(currentNode);
|
|
8819
9037
|
return true;
|
|
8820
9038
|
}
|
|
8821
9039
|
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
8822
9040
|
const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
|
|
8823
|
-
if (removed === false)
|
|
9041
|
+
if (removed === false) {
|
|
9042
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
9043
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
9044
|
+
}
|
|
8824
9045
|
return removed;
|
|
8825
9046
|
}
|
|
8826
|
-
if ((
|
|
9047
|
+
if (_readNodeType(currentNode) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
8827
9048
|
_forceRemove(currentNode);
|
|
8828
9049
|
return true;
|
|
8829
9050
|
}
|
|
@@ -8839,7 +9060,7 @@ function createDOMPurify() {
|
|
|
8839
9060
|
}
|
|
8840
9061
|
}
|
|
8841
9062
|
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
8842
|
-
return
|
|
9063
|
+
return _handleHookDetachedNode(currentNode, root);
|
|
8843
9064
|
};
|
|
8844
9065
|
/**
|
|
8845
9066
|
* _isValidAttribute
|
|
@@ -8851,20 +9072,17 @@ function createDOMPurify() {
|
|
|
8851
9072
|
*/
|
|
8852
9073
|
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
8853
9074
|
if (FORBID_ATTR[lcName]) return false;
|
|
8854
|
-
if (
|
|
8855
|
-
if (SAFE_FOR_XML && lcName === "for" && lcTag !== "label" && lcTag !== "output") return false;
|
|
9075
|
+
if (_isPatchLinkageAttribute(lcName, lcTag)) return false;
|
|
8856
9076
|
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
|
|
8857
9077
|
const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
|
|
8858
|
-
if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName));
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
else if (value) return false;
|
|
8867
|
-
return true;
|
|
9078
|
+
if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) return true;
|
|
9079
|
+
if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) return true;
|
|
9080
|
+
if (!nameIsPermitted) return _isBasicCustomElement(lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName, lcTag) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value);
|
|
9081
|
+
if (URI_SAFE_ATTRIBUTES[lcName]) return true;
|
|
9082
|
+
if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) return true;
|
|
9083
|
+
if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) return true;
|
|
9084
|
+
if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) return true;
|
|
9085
|
+
return !value;
|
|
8868
9086
|
};
|
|
8869
9087
|
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
|
|
8870
9088
|
"annotation-xml",
|
|
@@ -8909,24 +9127,38 @@ function createDOMPurify() {
|
|
|
8909
9127
|
/**
|
|
8910
9128
|
* Write a modified attribute value back onto the element. On
|
|
8911
9129
|
* success, re-probe for clobbering introduced by the new value and
|
|
8912
|
-
* remove the element when found; otherwise
|
|
8913
|
-
*
|
|
8914
|
-
*
|
|
9130
|
+
* remove the element when found; otherwise, when this writeback is the
|
|
9131
|
+
* recreate half of the SANITIZE_NAMED_PROPS remove-and-recreate, pop the
|
|
9132
|
+
* removal entry that path recorded so it does not show as removed. On
|
|
8915
9133
|
* failure, remove the attribute instead.
|
|
8916
9134
|
*
|
|
9135
|
+
* Returns true only on a clean write (the value was set and the new value
|
|
9136
|
+
* introduced no clobbering). The caller uses that, together with its own
|
|
9137
|
+
* knowledge of whether this attribute pushed a DOMPurify.removed record, to
|
|
9138
|
+
* decide whether to pop that record. The pop must happen ONLY for the
|
|
9139
|
+
* named-prop remove-and-recreate; popping on any other value change (trim,
|
|
9140
|
+
* template scrubbing, Trusted Types) would consume an unrelated _forceRemove
|
|
9141
|
+
* subtree-cleanup record and let that detached subtree keep a live event
|
|
9142
|
+
* handler through the IN_PLACE neutralization pass (SO-001).
|
|
9143
|
+
*
|
|
8917
9144
|
* @param currentNode the element carrying the attribute
|
|
8918
9145
|
* @param name the attribute name as present on the element
|
|
8919
9146
|
* @param namespaceURI the attribute's namespace, if any
|
|
8920
9147
|
* @param value the new attribute value
|
|
9148
|
+
* @return true if the value was written without introducing clobbering
|
|
8921
9149
|
*/
|
|
8922
9150
|
const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
|
|
8923
9151
|
try {
|
|
8924
9152
|
if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
|
|
8925
9153
|
else currentNode.setAttribute(name, value);
|
|
8926
|
-
if (_isClobbered(currentNode))
|
|
8927
|
-
|
|
9154
|
+
if (_isClobbered(currentNode)) {
|
|
9155
|
+
_forceRemove(currentNode);
|
|
9156
|
+
return false;
|
|
9157
|
+
}
|
|
9158
|
+
return true;
|
|
8928
9159
|
} catch (_) {
|
|
8929
9160
|
_removeAttribute(name, currentNode);
|
|
9161
|
+
return false;
|
|
8930
9162
|
}
|
|
8931
9163
|
};
|
|
8932
9164
|
/**
|
|
@@ -8938,9 +9170,11 @@ function createDOMPurify() {
|
|
|
8938
9170
|
* @protect setAttribute
|
|
8939
9171
|
*
|
|
8940
9172
|
* @param currentNode to sanitize
|
|
9173
|
+
* @param root the current walk root
|
|
8941
9174
|
*/
|
|
8942
|
-
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
9175
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode, root) {
|
|
8943
9176
|
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
9177
|
+
if (_handleHookDetachedNode(currentNode, root)) return;
|
|
8944
9178
|
const attributes = currentNode.attributes;
|
|
8945
9179
|
if (!attributes || _isClobbered(currentNode)) return;
|
|
8946
9180
|
ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
|
|
@@ -8959,6 +9193,7 @@ function createDOMPurify() {
|
|
|
8959
9193
|
const lcName = transformCaseFunc(name);
|
|
8960
9194
|
const initValue = attrValue;
|
|
8961
9195
|
let value = name === "value" ? initValue : stringTrim(initValue);
|
|
9196
|
+
let recreatedNamedProp = false;
|
|
8962
9197
|
hookEvent.attrName = lcName;
|
|
8963
9198
|
hookEvent.attrValue = value;
|
|
8964
9199
|
hookEvent.keepAttr = true;
|
|
@@ -8966,35 +9201,39 @@ function createDOMPurify() {
|
|
|
8966
9201
|
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
8967
9202
|
value = hookEvent.attrValue;
|
|
8968
9203
|
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
|
|
8969
|
-
_removeAttribute(name, currentNode);
|
|
9204
|
+
_removeAttribute(name, currentNode, attr);
|
|
8970
9205
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
9206
|
+
recreatedNamedProp = true;
|
|
8971
9207
|
}
|
|
8972
9208
|
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
8973
|
-
_removeAttribute(name, currentNode);
|
|
9209
|
+
_removeAttribute(name, currentNode, attr);
|
|
8974
9210
|
continue;
|
|
8975
9211
|
}
|
|
8976
9212
|
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
8977
|
-
_removeAttribute(name, currentNode);
|
|
9213
|
+
_removeAttribute(name, currentNode, attr);
|
|
8978
9214
|
continue;
|
|
8979
9215
|
}
|
|
8980
9216
|
if (hookEvent.forceKeepAttr) continue;
|
|
8981
9217
|
if (!hookEvent.keepAttr) {
|
|
8982
|
-
_removeAttribute(name, currentNode);
|
|
9218
|
+
_removeAttribute(name, currentNode, attr);
|
|
8983
9219
|
continue;
|
|
8984
9220
|
}
|
|
8985
9221
|
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
|
|
8986
|
-
_removeAttribute(name, currentNode);
|
|
9222
|
+
_removeAttribute(name, currentNode, attr);
|
|
8987
9223
|
continue;
|
|
8988
9224
|
}
|
|
8989
9225
|
if (SAFE_FOR_TEMPLATES) value = _stripTemplateExpressions(value);
|
|
8990
9226
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
8991
|
-
_removeAttribute(name, currentNode);
|
|
9227
|
+
_removeAttribute(name, currentNode, attr);
|
|
8992
9228
|
continue;
|
|
8993
9229
|
}
|
|
8994
9230
|
value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
|
|
8995
|
-
if (value !== initValue)
|
|
9231
|
+
if (value !== initValue) {
|
|
9232
|
+
if (_setAttributeValue(currentNode, name, namespaceURI, value) && recreatedNamedProp) arrayPop(DOMPurify.removed);
|
|
9233
|
+
}
|
|
8996
9234
|
}
|
|
8997
9235
|
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
9236
|
+
_handleHookDetachedNode(currentNode, root);
|
|
8998
9237
|
};
|
|
8999
9238
|
/**
|
|
9000
9239
|
* _sanitizeShadowDOM
|
|
@@ -9008,9 +9247,9 @@ function createDOMPurify() {
|
|
|
9008
9247
|
while (shadowNode = shadowIterator.nextNode()) {
|
|
9009
9248
|
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
9010
9249
|
_sanitizeElements(shadowNode, fragment);
|
|
9011
|
-
_sanitizeAttributes(shadowNode);
|
|
9250
|
+
_sanitizeAttributes(shadowNode, fragment);
|
|
9012
9251
|
if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content);
|
|
9013
|
-
if ((
|
|
9252
|
+
if (_readNodeType(shadowNode) === NODE_TYPE.element) {
|
|
9014
9253
|
const innerSr = getShadowRoot(shadowNode);
|
|
9015
9254
|
if (_isDocumentFragment(innerSr)) {
|
|
9016
9255
|
_sanitizeAttachedShadowRoots(innerSr);
|
|
@@ -9051,7 +9290,7 @@ function createDOMPurify() {
|
|
|
9051
9290
|
continue;
|
|
9052
9291
|
}
|
|
9053
9292
|
const node = item.node;
|
|
9054
|
-
const isElement = (
|
|
9293
|
+
const isElement = _readNodeType(node) === NODE_TYPE.element;
|
|
9055
9294
|
const childNodes = getChildNodes(node);
|
|
9056
9295
|
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push({
|
|
9057
9296
|
node: childNodes[i],
|
|
@@ -9102,7 +9341,7 @@ function createDOMPurify() {
|
|
|
9102
9341
|
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
9103
9342
|
if (inPlace) {
|
|
9104
9343
|
_neutralizePatchLinkage(dirty);
|
|
9105
|
-
const nn =
|
|
9344
|
+
const nn = _readNodeName(dirty);
|
|
9106
9345
|
if (typeof nn === "string") {
|
|
9107
9346
|
const tagName = transformCaseFunc(nn);
|
|
9108
9347
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
@@ -9126,7 +9365,7 @@ function createDOMPurify() {
|
|
|
9126
9365
|
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
|
|
9127
9366
|
else if (importedNode.nodeName === "HTML") body = importedNode;
|
|
9128
9367
|
else body.appendChild(importedNode);
|
|
9129
|
-
_sanitizeAttachedShadowRoots(
|
|
9368
|
+
_sanitizeAttachedShadowRoots(body);
|
|
9130
9369
|
} else {
|
|
9131
9370
|
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
|
|
9132
9371
|
body = _initDocument(dirty);
|
|
@@ -9138,7 +9377,7 @@ function createDOMPurify() {
|
|
|
9138
9377
|
const nodeIterator = _createNodeIterator(walkRoot);
|
|
9139
9378
|
while (currentNode = nodeIterator.nextNode()) {
|
|
9140
9379
|
_sanitizeElements(currentNode, walkRoot);
|
|
9141
|
-
_sanitizeAttributes(currentNode);
|
|
9380
|
+
_sanitizeAttributes(currentNode, walkRoot);
|
|
9142
9381
|
if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
|
|
9143
9382
|
}
|
|
9144
9383
|
} catch (error) {
|
|
@@ -9151,9 +9390,14 @@ function createDOMPurify() {
|
|
|
9151
9390
|
throw error;
|
|
9152
9391
|
}
|
|
9153
9392
|
if (inPlace) {
|
|
9393
|
+
let rootWasRemoved = false;
|
|
9154
9394
|
arrayForEach(DOMPurify.removed, (entry) => {
|
|
9155
|
-
if (entry.element)
|
|
9395
|
+
if (entry.element) {
|
|
9396
|
+
if (entry.element === dirty) rootWasRemoved = true;
|
|
9397
|
+
_neutralizeSubtree(entry.element);
|
|
9398
|
+
}
|
|
9156
9399
|
});
|
|
9400
|
+
if (rootWasRemoved) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
9157
9401
|
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
|
|
9158
9402
|
return dirty;
|
|
9159
9403
|
}
|
|
@@ -14929,6 +15173,7 @@ var kdsCheckboxValues = Object.values(kdsCheckboxValue);
|
|
|
14929
15173
|
//#endregion
|
|
14930
15174
|
//#region src/components/forms/ToggleSwitch/enums.ts
|
|
14931
15175
|
var kdsToggleSwitchSize = {
|
|
15176
|
+
XSMALL: "xsmall",
|
|
14932
15177
|
SMALL: "small",
|
|
14933
15178
|
MEDIUM: "medium"
|
|
14934
15179
|
};
|
|
@@ -15004,13 +15249,14 @@ var KdsToggleSwitch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
15004
15249
|
type: "button",
|
|
15005
15250
|
role: "switch",
|
|
15006
15251
|
onClick: handleClick
|
|
15007
|
-
}, [createElementVNode("div", _hoisted_2$29, [createElementVNode("div", _hoisted_3$23, [
|
|
15252
|
+
}, [createElementVNode("div", _hoisted_2$29, [createElementVNode("div", _hoisted_3$23, [__props.size !== unref(kdsToggleSwitchSize).XSMALL ? (openBlock(), createBlock(KdsIcon_default, {
|
|
15253
|
+
key: 0,
|
|
15008
15254
|
name: isChecked.value ? "checkmark" : "x-close",
|
|
15009
15255
|
size: __props.size === "small" ? "xsmall" : "small"
|
|
15010
|
-
}, null, 8, ["name", "size"])])]), props.label ? (openBlock(), createElementBlock("div", _hoisted_4$21, [createElementVNode("span", _hoisted_5$13, toDisplayString(props.label), 1)])) : createCommentVNode("", true)], 10, _hoisted_1$49);
|
|
15256
|
+
}, null, 8, ["name", "size"])) : createCommentVNode("", true)])]), props.label ? (openBlock(), createElementBlock("div", _hoisted_4$21, [createElementVNode("span", _hoisted_5$13, toDisplayString(props.label), 1)])) : createCommentVNode("", true)], 10, _hoisted_1$49);
|
|
15011
15257
|
};
|
|
15012
15258
|
}
|
|
15013
|
-
}), [["__scopeId", "data-v-
|
|
15259
|
+
}), [["__scopeId", "data-v-1f2d16a6"]]);
|
|
15014
15260
|
//#endregion
|
|
15015
15261
|
//#region src/components/forms/RadioButton/KdsRadioButton.vue?vue&type=script&setup=true&lang.ts
|
|
15016
15262
|
var _hoisted_1$48 = [
|