@mulmoclaude/core 7.2.1 → 7.3.1
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/assets/helps/collection-skills.md +8 -0
- package/dist/collection/core/schemaZ.d.ts +8 -0
- package/dist/collection/registry/server/index.cjs +2 -2
- package/dist/collection/registry/server/index.js +2 -2
- package/dist/collection/server/index.cjs +2 -2
- package/dist/collection/server/index.js +2 -2
- package/dist/collection-watchers/index.cjs +2 -2
- package/dist/collection-watchers/index.js +2 -2
- package/dist/{discovery-D3e3JaAv.cjs → discovery-DxmMcpFo.cjs} +5 -1
- package/dist/{discovery-D3e3JaAv.cjs.map → discovery-DxmMcpFo.cjs.map} +1 -1
- package/dist/{discovery-BIQY56d1.js → discovery-RyuhNKjx.js} +5 -1
- package/dist/{discovery-BIQY56d1.js.map → discovery-RyuhNKjx.js.map} +1 -1
- package/dist/feeds/server/index.cjs +2 -2
- package/dist/feeds/server/index.js +2 -2
- package/dist/google/index.cjs +1 -1
- package/dist/google/index.js +1 -1
- package/dist/plugin-vue/index.cjs +185 -31
- package/dist/plugin-vue/index.cjs.map +1 -1
- package/dist/plugin-vue/index.js +185 -31
- package/dist/plugin-vue/index.js.map +1 -1
- package/dist/{server-BGxmZppB.cjs → server-ZKTtI8_W.cjs} +2 -2
- package/dist/{server-BGxmZppB.cjs.map → server-ZKTtI8_W.cjs.map} +1 -1
- package/dist/{server-MKJPGYKI.js → server-xdXBsiba.js} +2 -2
- package/dist/{server-MKJPGYKI.js.map → server-xdXBsiba.js.map} +1 -1
- package/package.json +2 -2
package/dist/plugin-vue/index.js
CHANGED
|
@@ -131,7 +131,7 @@ IconGlyph.props = {
|
|
|
131
131
|
fontClass: String
|
|
132
132
|
};
|
|
133
133
|
// ../../node_modules/dompurify/dist/purify.es.mjs
|
|
134
|
-
/*! @license DOMPurify 3.
|
|
134
|
+
/*! @license DOMPurify 3.5.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.5.0/LICENSE */
|
|
135
135
|
function _OverloadYield(e, d) {
|
|
136
136
|
this.v = e, this.k = d;
|
|
137
137
|
}
|
|
@@ -261,6 +261,10 @@ var arrayIsArray = Array.isArray;
|
|
|
261
261
|
var setCreate = unconstruct(Set);
|
|
262
262
|
var setAdd = unapply(Set.prototype.add);
|
|
263
263
|
var setHas = unapply(Set.prototype.has);
|
|
264
|
+
var setDelete = unapply(Set.prototype.delete);
|
|
265
|
+
var mapCreate = unconstruct(Map);
|
|
266
|
+
var mapGet = unapply(Map.prototype.get);
|
|
267
|
+
var mapSet = unapply(Map.prototype.set);
|
|
264
268
|
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
265
269
|
var stringToString = unapply(String.prototype.toString);
|
|
266
270
|
var stringMatch = unapply(String.prototype.match);
|
|
@@ -1096,7 +1100,9 @@ var xml = freeze([
|
|
|
1096
1100
|
var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
|
|
1097
1101
|
var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
|
|
1098
1102
|
var TMPLIT_EXPR = seal(/\${[\w\W]*/g);
|
|
1099
|
-
var
|
|
1103
|
+
var TMPL_MARKER = seal(/{{|}}|\${|<%|%>/);
|
|
1104
|
+
var NON_WHITESPACE = seal(/[^\t\n\f\r ]/);
|
|
1105
|
+
var NUL = seal(/\u0000/g);
|
|
1100
1106
|
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
|
|
1101
1107
|
var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
|
1102
1108
|
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
|
|
@@ -1106,6 +1112,7 @@ var DOCTYPE_NAME = seal(/^html$/i);
|
|
|
1106
1112
|
var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
1107
1113
|
var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
|
|
1108
1114
|
var COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
|
|
1115
|
+
var COMMENT_UNSAFE = seal(/<[/\w]|^-?>|--!?>|<!-$/g);
|
|
1109
1116
|
var FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
|
|
1110
1117
|
var SELF_CLOSING_TAG = seal(/\/>/i);
|
|
1111
1118
|
var ATTR_VALUE_BREAKOUT = seal(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i);
|
|
@@ -1128,6 +1135,27 @@ var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, [
|
|
|
1128
1135
|
"plaintext",
|
|
1129
1136
|
"noscript"
|
|
1130
1137
|
]));
|
|
1138
|
+
var ESCAPABLE_TEXT_ELEMENTS = freeze(addToSet({}, ["textarea", "title"]));
|
|
1139
|
+
var VOID_ELEMENTS = freeze(addToSet({}, [
|
|
1140
|
+
"area",
|
|
1141
|
+
"base",
|
|
1142
|
+
"basefont",
|
|
1143
|
+
"bgsound",
|
|
1144
|
+
"br",
|
|
1145
|
+
"col",
|
|
1146
|
+
"embed",
|
|
1147
|
+
"frame",
|
|
1148
|
+
"hr",
|
|
1149
|
+
"img",
|
|
1150
|
+
"input",
|
|
1151
|
+
"keygen",
|
|
1152
|
+
"link",
|
|
1153
|
+
"meta",
|
|
1154
|
+
"param",
|
|
1155
|
+
"source",
|
|
1156
|
+
"track",
|
|
1157
|
+
"wbr"
|
|
1158
|
+
]));
|
|
1131
1159
|
var getGlobal = function getGlobal() {
|
|
1132
1160
|
return typeof window === "undefined" ? null : window;
|
|
1133
1161
|
};
|
|
@@ -1199,7 +1227,7 @@ var _resolveObjectOption = function _resolveObjectOption(cfg, key, fallback) {
|
|
|
1199
1227
|
function createDOMPurify() {
|
|
1200
1228
|
let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
1201
1229
|
const DOMPurify = (root) => createDOMPurify(root);
|
|
1202
|
-
DOMPurify.version = "3.
|
|
1230
|
+
DOMPurify.version = "3.5.0";
|
|
1203
1231
|
DOMPurify.removed = [];
|
|
1204
1232
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
1205
1233
|
DOMPurify.isSupported = false;
|
|
@@ -1212,6 +1240,7 @@ function createDOMPurify() {
|
|
|
1212
1240
|
const ElementPrototype = Element.prototype;
|
|
1213
1241
|
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
|
1214
1242
|
const remove = lookupGetter(ElementPrototype, "remove");
|
|
1243
|
+
const removeChild = lookupGetter(ElementPrototype, "removeChild");
|
|
1215
1244
|
const removeAttributeNode = lookupGetter(ElementPrototype, "removeAttributeNode");
|
|
1216
1245
|
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
1217
1246
|
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
@@ -1231,6 +1260,9 @@ function createDOMPurify() {
|
|
|
1231
1260
|
const _readNamespaceURI = function _readNamespaceURI(element) {
|
|
1232
1261
|
return getNamespaceURI ? getNamespaceURI(element) : element.namespaceURI;
|
|
1233
1262
|
};
|
|
1263
|
+
const _readAttributes = function _readAttributes(node) {
|
|
1264
|
+
return _readNodeType(node) === NODE_TYPE.element ? getAttributes(node) : null;
|
|
1265
|
+
};
|
|
1234
1266
|
if (typeof HTMLTemplateElement === "function") {
|
|
1235
1267
|
const template = document.createElement("template");
|
|
1236
1268
|
if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
|
|
@@ -1336,6 +1368,7 @@ function createDOMPurify() {
|
|
|
1336
1368
|
let KEEP_CONTENT = true;
|
|
1337
1369
|
let IN_PLACE = false;
|
|
1338
1370
|
let IN_PLACE_VISITED = null;
|
|
1371
|
+
let IN_PLACE_RETURNS = null;
|
|
1339
1372
|
let USE_PROFILES = false;
|
|
1340
1373
|
let FORBID_CONTENTS = null;
|
|
1341
1374
|
const DEFAULT_FORBID_CONTENTS = addToSet({}, [
|
|
@@ -1426,6 +1459,7 @@ function createDOMPurify() {
|
|
|
1426
1459
|
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
1427
1460
|
let transformCaseFunc = null;
|
|
1428
1461
|
let CONFIG = null;
|
|
1462
|
+
let ACTIVE_CONFIG = null;
|
|
1429
1463
|
const formElement = document.createElement("form");
|
|
1430
1464
|
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
1431
1465
|
return testValue instanceof RegExp || testValue instanceof Function;
|
|
@@ -1631,6 +1665,7 @@ function createDOMPurify() {
|
|
|
1631
1665
|
*/
|
|
1632
1666
|
const _forceRemove = function _forceRemove(node) {
|
|
1633
1667
|
arrayPush(DOMPurify.removed, { element: node });
|
|
1668
|
+
_unmarkVisited(node);
|
|
1634
1669
|
try {
|
|
1635
1670
|
getParentNode(node).removeChild(node);
|
|
1636
1671
|
} catch (_) {
|
|
@@ -1669,7 +1704,7 @@ function createDOMPurify() {
|
|
|
1669
1704
|
const childNodes = getChildNodes(root);
|
|
1670
1705
|
if (childNodes) arrayForEach(arraySlice(childNodes), (child) => {
|
|
1671
1706
|
try {
|
|
1672
|
-
|
|
1707
|
+
removeChild(root, child);
|
|
1673
1708
|
} catch (_) {}
|
|
1674
1709
|
});
|
|
1675
1710
|
if (_readNodeType(root) === NODE_TYPE.element) _stripAttributes(root, false);
|
|
@@ -1807,6 +1842,18 @@ function createDOMPurify() {
|
|
|
1807
1842
|
_neutralizeEscapedElements(root, before);
|
|
1808
1843
|
return rootRemoved;
|
|
1809
1844
|
};
|
|
1845
|
+
/**
|
|
1846
|
+
* Fail-closed teardown of an in-place tree that cannot be returned: empties
|
|
1847
|
+
* the root and neutralizes everything that was under it, open shadow roots
|
|
1848
|
+
* included.
|
|
1849
|
+
*
|
|
1850
|
+
* @param root the in-place root
|
|
1851
|
+
* @param before the root's nodes, collected before the walk
|
|
1852
|
+
*/
|
|
1853
|
+
const _failClosed = function _failClosed(root, before) {
|
|
1854
|
+
_neutralizeRoot(root);
|
|
1855
|
+
_neutralizeDiscarded(root, before);
|
|
1856
|
+
};
|
|
1810
1857
|
const MAX_UNVISITED_ROUNDS = 8;
|
|
1811
1858
|
/**
|
|
1812
1859
|
* The walk only moves forward, so a node moved to a position it already
|
|
@@ -1863,11 +1910,28 @@ function createDOMPurify() {
|
|
|
1863
1910
|
};
|
|
1864
1911
|
/**
|
|
1865
1912
|
* Records that _sanitizeElements processed `node`. No-op outside IN_PLACE.
|
|
1913
|
+
* Fails closed when a node that left the tree comes back too often.
|
|
1866
1914
|
*
|
|
1867
1915
|
* @param node the node being processed
|
|
1868
1916
|
*/
|
|
1869
1917
|
const _markVisited = function _markVisited(node) {
|
|
1870
|
-
if (IN_PLACE_VISITED)
|
|
1918
|
+
if (!IN_PLACE_VISITED) return;
|
|
1919
|
+
setAdd(IN_PLACE_VISITED, node);
|
|
1920
|
+
const returns = mapGet(IN_PLACE_RETURNS, node);
|
|
1921
|
+
if (returns === void 0) return;
|
|
1922
|
+
if (returns >= MAX_UNVISITED_ROUNDS) throw typeErrorCreate("the tree kept changing during in-place sanitization; refusing to return it");
|
|
1923
|
+
mapSet(IN_PLACE_RETURNS, node, returns + 1);
|
|
1924
|
+
};
|
|
1925
|
+
/**
|
|
1926
|
+
* Forgets that `node` was processed: it was removed or detached. If a hook
|
|
1927
|
+
* or custom element puts it back, _sanitizeUnvisitedNodes handles it again.
|
|
1928
|
+
*
|
|
1929
|
+
* @param node the node that left the tree
|
|
1930
|
+
*/
|
|
1931
|
+
const _unmarkVisited = function _unmarkVisited(node) {
|
|
1932
|
+
if (!IN_PLACE_VISITED) return;
|
|
1933
|
+
setDelete(IN_PLACE_VISITED, node);
|
|
1934
|
+
if (mapGet(IN_PLACE_RETURNS, node) === void 0) mapSet(IN_PLACE_RETURNS, node, 0);
|
|
1871
1935
|
};
|
|
1872
1936
|
/**
|
|
1873
1937
|
* Patch-linkage attributes (declarative partial updates): `patchsrc`
|
|
@@ -1990,6 +2054,47 @@ function createDOMPurify() {
|
|
|
1990
2054
|
if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
|
|
1991
2055
|
});
|
|
1992
2056
|
};
|
|
2057
|
+
const TABLE_STRUCTURE = "table,tbody,thead,tfoot,tr,colgroup";
|
|
2058
|
+
const TABLE_CONTENT = addToSet({}, [
|
|
2059
|
+
"caption",
|
|
2060
|
+
"colgroup",
|
|
2061
|
+
"col",
|
|
2062
|
+
"thead",
|
|
2063
|
+
"tbody",
|
|
2064
|
+
"tfoot",
|
|
2065
|
+
"tr",
|
|
2066
|
+
"td",
|
|
2067
|
+
"th",
|
|
2068
|
+
"style",
|
|
2069
|
+
"script",
|
|
2070
|
+
"template"
|
|
2071
|
+
]);
|
|
2072
|
+
/**
|
|
2073
|
+
* Moves content the HTML parser would foster-parent to where it would put
|
|
2074
|
+
* it: in front of the table. Only a tree the parser did not build, or one
|
|
2075
|
+
* changed after the parse, holds such content. Without this, a reparse
|
|
2076
|
+
* reorders the text and can join fragments that were not neighbours.
|
|
2077
|
+
*
|
|
2078
|
+
* @param root The root whose tables should be checked.
|
|
2079
|
+
*/
|
|
2080
|
+
const _fosterTableContent = function _fosterTableContent(root) {
|
|
2081
|
+
var _root$querySelectorAl;
|
|
2082
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml") return;
|
|
2083
|
+
const structures = (_root$querySelectorAl = root.querySelectorAll) === null || _root$querySelectorAl === void 0 ? void 0 : _root$querySelectorAl.call(root, TABLE_STRUCTURE);
|
|
2084
|
+
if (!structures || structures.length === 0) return;
|
|
2085
|
+
arrayForEach(structures, (structure) => {
|
|
2086
|
+
arrayForEach(arraySlice(getChildNodes(structure)), (child) => {
|
|
2087
|
+
const nodeType = _readNodeType(child);
|
|
2088
|
+
if (!(nodeType === NODE_TYPE.text ? regExpTest(NON_WHITESPACE, child.data) : nodeType === NODE_TYPE.element && !TABLE_CONTENT[stringToLowerCase(_readNodeName(child))])) return;
|
|
2089
|
+
let table = structure;
|
|
2090
|
+
while (table && stringToLowerCase(_readNodeName(table)) !== "table") table = table === root ? null : getParentNode(table);
|
|
2091
|
+
const tableParent = table && table !== root ? getParentNode(table) : null;
|
|
2092
|
+
if (tableParent) try {
|
|
2093
|
+
tableParent.insertBefore(child, table);
|
|
2094
|
+
} catch (_) {}
|
|
2095
|
+
});
|
|
2096
|
+
});
|
|
2097
|
+
};
|
|
1993
2098
|
/**
|
|
1994
2099
|
* Normalizes `node` and strips template expressions from its own character
|
|
1995
2100
|
* data. Template contents and shadow roots are not entered, their own
|
|
@@ -1998,11 +2103,28 @@ function createDOMPurify() {
|
|
|
1998
2103
|
* @param node The root whose own character data should be scrubbed.
|
|
1999
2104
|
*/
|
|
2000
2105
|
const _scrubOwnCharacterData = function _scrubOwnCharacterData(node) {
|
|
2106
|
+
_fosterTableContent(node);
|
|
2001
2107
|
node.normalize();
|
|
2002
2108
|
const walker = _createNodeIterator(node, true);
|
|
2109
|
+
let previousText = null;
|
|
2003
2110
|
let currentNode = walker.nextNode();
|
|
2004
2111
|
while (currentNode) {
|
|
2005
|
-
|
|
2112
|
+
let data = currentNode.data;
|
|
2113
|
+
if (regExpTest(NUL, data)) {
|
|
2114
|
+
data = stringReplace(data, NUL, "");
|
|
2115
|
+
currentNode.data = data;
|
|
2116
|
+
}
|
|
2117
|
+
if (regExpTest(TMPL_MARKER, data)) {
|
|
2118
|
+
data = _stripTemplateExpressions(data);
|
|
2119
|
+
currentNode.data = data;
|
|
2120
|
+
}
|
|
2121
|
+
if (data && _readNodeType(currentNode) === NODE_TYPE.text) {
|
|
2122
|
+
if (previousText) {
|
|
2123
|
+
const tail = previousText.data;
|
|
2124
|
+
if (regExpTest(TMPL_MARKER, tail[tail.length - 1] + data[0])) previousText.data = _stripTemplateExpressions(tail + data[0]);
|
|
2125
|
+
}
|
|
2126
|
+
previousText = currentNode;
|
|
2127
|
+
}
|
|
2006
2128
|
currentNode = walker.nextNode();
|
|
2007
2129
|
}
|
|
2008
2130
|
};
|
|
@@ -2049,6 +2171,27 @@ function createDOMPurify() {
|
|
|
2049
2171
|
});
|
|
2050
2172
|
}
|
|
2051
2173
|
/**
|
|
2174
|
+
* Elements in a state the HTML parser never produces: a void element with
|
|
2175
|
+
* children, a text-only element with an element child or, for literal-text
|
|
2176
|
+
* elements, with markup-like text. See VOID_ELEMENTS, LITERAL_TEXT_ELEMENTS
|
|
2177
|
+
* and ESCAPABLE_TEXT_ELEMENTS. Reads textContent, as an XML document
|
|
2178
|
+
* escapes innerHTML. Elements only: a processing instruction's nodeName is
|
|
2179
|
+
* its target and can collide with these names.
|
|
2180
|
+
*
|
|
2181
|
+
* @param currentNode the element to inspect
|
|
2182
|
+
* @param tagName the element's transformCaseFunc'd tag name
|
|
2183
|
+
* @return true if the element must be removed
|
|
2184
|
+
*/
|
|
2185
|
+
const _isMalformedElement = function _isMalformedElement(currentNode, tagName) {
|
|
2186
|
+
const isVoid = Boolean(VOID_ELEMENTS[tagName]);
|
|
2187
|
+
const literal = Boolean(LITERAL_TEXT_ELEMENTS[tagName]);
|
|
2188
|
+
if (!isVoid && !literal && !ESCAPABLE_TEXT_ELEMENTS[tagName]) return false;
|
|
2189
|
+
if (_readNamespaceURI(currentNode) !== HTML_NAMESPACE) return false;
|
|
2190
|
+
if (isVoid) return currentNode.hasChildNodes();
|
|
2191
|
+
if (_isNode(currentNode.firstElementChild)) return true;
|
|
2192
|
+
return literal && typeof currentNode.textContent === "string" && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent);
|
|
2193
|
+
};
|
|
2194
|
+
/**
|
|
2052
2195
|
* Structural-threat checks that condemn a node regardless of the
|
|
2053
2196
|
* allowlists: mXSS via namespace confusion, risky CSS construction,
|
|
2054
2197
|
* processing instructions, markup-bearing comments. Pure predicate;
|
|
@@ -2061,9 +2204,9 @@ function createDOMPurify() {
|
|
|
2061
2204
|
*/
|
|
2062
2205
|
const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName, nodeType) {
|
|
2063
2206
|
if (SAFE_FOR_XML && nodeType === NODE_TYPE.element && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
|
|
2064
|
-
if (SAFE_FOR_XML &&
|
|
2207
|
+
if (SAFE_FOR_XML && nodeType === NODE_TYPE.element && _isMalformedElement(currentNode, tagName)) return true;
|
|
2065
2208
|
if (nodeType === NODE_TYPE.processingInstruction) return true;
|
|
2066
|
-
if (SAFE_FOR_XML && nodeType === NODE_TYPE.comment && regExpTest(
|
|
2209
|
+
if (SAFE_FOR_XML && nodeType === NODE_TYPE.comment && regExpTest(COMMENT_UNSAFE, currentNode.data)) return true;
|
|
2067
2210
|
return false;
|
|
2068
2211
|
};
|
|
2069
2212
|
/**
|
|
@@ -2139,6 +2282,7 @@ function createDOMPurify() {
|
|
|
2139
2282
|
const _handleHookDetachedNode = function _handleHookDetachedNode(currentNode, root) {
|
|
2140
2283
|
if (currentNode === root || getParentNode(currentNode) !== null) return false;
|
|
2141
2284
|
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
2285
|
+
_unmarkVisited(currentNode);
|
|
2142
2286
|
return true;
|
|
2143
2287
|
};
|
|
2144
2288
|
/**
|
|
@@ -2170,14 +2314,7 @@ function createDOMPurify() {
|
|
|
2170
2314
|
_forceRemove(currentNode);
|
|
2171
2315
|
return true;
|
|
2172
2316
|
}
|
|
2173
|
-
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName])
|
|
2174
|
-
const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
|
|
2175
|
-
if (removed === false) {
|
|
2176
|
-
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
2177
|
-
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
2178
|
-
}
|
|
2179
|
-
return removed;
|
|
2180
|
-
}
|
|
2317
|
+
if ((FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) && _sanitizeDisallowedNode(currentNode, tagName, root)) return true;
|
|
2181
2318
|
if (nodeType === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
2182
2319
|
_forceRemove(currentNode);
|
|
2183
2320
|
return true;
|
|
@@ -2311,7 +2448,7 @@ function createDOMPurify() {
|
|
|
2311
2448
|
const _sanitizeAttributes = function _sanitizeAttributes(currentNode, root) {
|
|
2312
2449
|
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
2313
2450
|
if (_handleHookDetachedNode(currentNode, root)) return;
|
|
2314
|
-
const attributes = currentNode
|
|
2451
|
+
const attributes = _readAttributes(currentNode);
|
|
2315
2452
|
if (!attributes || _isClobbered(currentNode)) return;
|
|
2316
2453
|
ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
|
|
2317
2454
|
const hookEvent = {
|
|
@@ -2325,6 +2462,7 @@ function createDOMPurify() {
|
|
|
2325
2462
|
const lcTag = transformCaseFunc(_readNodeName(currentNode));
|
|
2326
2463
|
while (l--) {
|
|
2327
2464
|
const attr = attributes[l];
|
|
2465
|
+
if (!attr) continue;
|
|
2328
2466
|
const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
|
|
2329
2467
|
const lcName = transformCaseFunc(name);
|
|
2330
2468
|
const initValue = attrValue;
|
|
@@ -2449,7 +2587,7 @@ function createDOMPurify() {
|
|
|
2449
2587
|
}
|
|
2450
2588
|
}
|
|
2451
2589
|
};
|
|
2452
|
-
|
|
2590
|
+
const _sanitize = function _sanitize(dirty) {
|
|
2453
2591
|
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2454
2592
|
let body = null;
|
|
2455
2593
|
let importedNode = null;
|
|
@@ -2466,26 +2604,29 @@ function createDOMPurify() {
|
|
|
2466
2604
|
ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
|
|
2467
2605
|
ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
|
|
2468
2606
|
} else _parseConfig(cfg);
|
|
2607
|
+
ACTIVE_CONFIG = CONFIG;
|
|
2469
2608
|
DOMPurify.removed = [];
|
|
2470
2609
|
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
2471
2610
|
let inPlaceNodes = [];
|
|
2472
2611
|
const outerVisited = IN_PLACE_VISITED;
|
|
2612
|
+
const outerReturns = IN_PLACE_RETURNS;
|
|
2473
2613
|
if (inPlace) {
|
|
2474
2614
|
_neutralizePatchLinkage(dirty);
|
|
2615
|
+
inPlaceNodes = _collectLiveNodes(dirty);
|
|
2475
2616
|
const nn = _readNodeName(dirty);
|
|
2476
2617
|
if (typeof nn === "string") {
|
|
2477
2618
|
const tagName = transformCaseFunc(nn);
|
|
2478
2619
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
2479
|
-
|
|
2620
|
+
_failClosed(dirty, inPlaceNodes);
|
|
2480
2621
|
throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
2481
2622
|
}
|
|
2482
2623
|
}
|
|
2483
2624
|
if (_isClobbered(dirty)) {
|
|
2484
|
-
|
|
2625
|
+
_failClosed(dirty, inPlaceNodes);
|
|
2485
2626
|
throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
|
|
2486
2627
|
}
|
|
2487
|
-
inPlaceNodes = _collectLiveNodes(dirty);
|
|
2488
2628
|
IN_PLACE_VISITED = setCreate();
|
|
2629
|
+
IN_PLACE_RETURNS = mapCreate();
|
|
2489
2630
|
} else if (_isNode(dirty)) {
|
|
2490
2631
|
body = _initDocument("<!---->");
|
|
2491
2632
|
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
@@ -2506,13 +2647,11 @@ function createDOMPurify() {
|
|
|
2506
2647
|
while (currentNode = nodeIterator.nextNode()) _sanitizeNode(currentNode, walkRoot);
|
|
2507
2648
|
if (inPlace) _sanitizeUnvisitedNodes(dirty, inPlaceNodes);
|
|
2508
2649
|
} catch (error) {
|
|
2509
|
-
if (inPlace)
|
|
2510
|
-
_neutralizeRoot(dirty);
|
|
2511
|
-
_neutralizeDiscarded(dirty, inPlaceNodes);
|
|
2512
|
-
}
|
|
2650
|
+
if (inPlace) _failClosed(dirty, inPlaceNodes);
|
|
2513
2651
|
throw error;
|
|
2514
2652
|
} finally {
|
|
2515
2653
|
IN_PLACE_VISITED = outerVisited;
|
|
2654
|
+
IN_PLACE_RETURNS = outerReturns;
|
|
2516
2655
|
}
|
|
2517
2656
|
if (inPlace) {
|
|
2518
2657
|
if (_neutralizeDiscarded(dirty, inPlaceNodes)) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
@@ -2528,15 +2667,30 @@ function createDOMPurify() {
|
|
|
2528
2667
|
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
|
|
2529
2668
|
return returnNode;
|
|
2530
2669
|
}
|
|
2531
|
-
|
|
2532
|
-
let serializedHTML =
|
|
2533
|
-
if (SAFE_FOR_TEMPLATES && regExpTest(TMPL_MARKER_SERIALIZED, serializedHTML)) {
|
|
2534
|
-
_scrubOwnCharacterData(body);
|
|
2535
|
-
serializedHTML = serialize();
|
|
2536
|
-
}
|
|
2670
|
+
if (SAFE_FOR_TEMPLATES) _scrubOwnCharacterData(body);
|
|
2671
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
2537
2672
|
if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
|
2538
2673
|
return _signOutput(serializedHTML);
|
|
2539
2674
|
};
|
|
2675
|
+
DOMPurify.sanitize = function(dirty) {
|
|
2676
|
+
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2677
|
+
const outerConfig = ACTIVE_CONFIG;
|
|
2678
|
+
const outerTags = ALLOWED_TAGS;
|
|
2679
|
+
const outerAttr = ALLOWED_ATTR;
|
|
2680
|
+
const outerRemoved = DOMPurify.removed;
|
|
2681
|
+
ACTIVE_CONFIG = null;
|
|
2682
|
+
try {
|
|
2683
|
+
return _sanitize(dirty, cfg);
|
|
2684
|
+
} finally {
|
|
2685
|
+
ACTIVE_CONFIG = outerConfig;
|
|
2686
|
+
if (outerConfig) {
|
|
2687
|
+
if (!SET_CONFIG) _parseConfig(outerConfig);
|
|
2688
|
+
ALLOWED_TAGS = outerTags;
|
|
2689
|
+
ALLOWED_ATTR = outerAttr;
|
|
2690
|
+
DOMPurify.removed = outerRemoved;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2540
2694
|
DOMPurify.setConfig = function() {
|
|
2541
2695
|
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2542
2696
|
_parseConfig(cfg);
|