@mirai/core 0.3.355 → 0.3.356
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.
|
@@ -9,11 +9,15 @@ const sanitizeComponent = el => {
|
|
|
9
9
|
let ghost;
|
|
10
10
|
Array.from(el.children).forEach(child => {
|
|
11
11
|
const dataset = Object.keys(child.dataset);
|
|
12
|
-
if (child.dataset['content']) content.push(child.cloneNode(true));else if (!ghost && child.dataset['ghost']) ghost = child.cloneNode(true);else if (!dataset.includes('role')) {
|
|
13
|
-
|
|
12
|
+
if (child.dataset['content']) content.push(child.cloneNode(true));else if (!ghost && child.dataset['ghost']) ghost = child.cloneNode(true);else if (!dataset.includes('role') && child.parentNode === el) {
|
|
13
|
+
try {
|
|
14
14
|
el.removeChild(child);
|
|
15
|
-
}
|
|
16
|
-
|
|
15
|
+
} catch (error) {
|
|
16
|
+
// eslint-disable-next-line no-console
|
|
17
|
+
console.warn("WARNING: parentNode can not remove child.", {
|
|
18
|
+
el,
|
|
19
|
+
child
|
|
20
|
+
});
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeComponent.js","names":["sanitizeComponent","el","content","ghost","Array","from","children","forEach","child","dataset","Object","keys","push","cloneNode","includes","parentNode","removeChild","console","warn","length","dangerousChildren","exports"],"sources":["../../src/helpers/sanitizeComponent.js"],"sourcesContent":["export const sanitizeComponent = (el) => {\n const content = [];\n let ghost;\n\n Array.from(el.children).forEach((child) => {\n const dataset = Object.keys(child.dataset);\n\n if (child.dataset['content']) content.push(child.cloneNode(true));\n else if (!ghost && child.dataset['ghost']) ghost = child.cloneNode(true);\n else if (!dataset.includes('role')
|
|
1
|
+
{"version":3,"file":"sanitizeComponent.js","names":["sanitizeComponent","el","content","ghost","Array","from","children","forEach","child","dataset","Object","keys","push","cloneNode","includes","parentNode","removeChild","error","console","warn","length","dangerousChildren","exports"],"sources":["../../src/helpers/sanitizeComponent.js"],"sourcesContent":["export const sanitizeComponent = (el) => {\n const content = [];\n let ghost;\n\n Array.from(el.children).forEach((child) => {\n const dataset = Object.keys(child.dataset);\n\n if (child.dataset['content']) content.push(child.cloneNode(true));\n else if (!ghost && child.dataset['ghost']) ghost = child.cloneNode(true);\n else if (!dataset.includes('role') && child.parentNode === el) {\n try {\n el.removeChild(child);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(`WARNING: parentNode can not remove child.`, { el, child });\n }\n }\n });\n\n return content.length > 0\n ? {\n dangerousChildren: Array.from(content),\n el,\n ghost,\n }\n : {};\n};\n"],"mappings":";;;;;;AAAO,MAAMA,iBAAiB,GAAIC,EAAE,IAAK;EACvC,MAAMC,OAAO,GAAG,EAAE;EAClB,IAAIC,KAAK;EAETC,KAAK,CAACC,IAAI,CAACJ,EAAE,CAACK,QAAQ,CAAC,CAACC,OAAO,CAAEC,KAAK,IAAK;IACzC,MAAMC,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACH,KAAK,CAACC,OAAO,CAAC;IAE1C,IAAID,KAAK,CAACC,OAAO,CAAC,SAAS,CAAC,EAAEP,OAAO,CAACU,IAAI,CAACJ,KAAK,CAACK,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAC7D,IAAI,CAACV,KAAK,IAAIK,KAAK,CAACC,OAAO,CAAC,OAAO,CAAC,EAAEN,KAAK,GAAGK,KAAK,CAACK,SAAS,CAAC,IAAI,CAAC,CAAC,KACpE,IAAI,CAACJ,OAAO,CAACK,QAAQ,CAAC,MAAM,CAAC,IAAIN,KAAK,CAACO,UAAU,KAAKd,EAAE,EAAE;MAC7D,IAAI;QACFA,EAAE,CAACe,WAAW,CAACR,KAAK,CAAC;MACvB,CAAC,CAAC,OAAOS,KAAK,EAAE;QACd;QACAC,OAAO,CAACC,IAAI,8CAA8C;UAAElB,EAAE;UAAEO;QAAM,CAAC,CAAC;MAC1E;IACF;EACF,CAAC,CAAC;EAEF,OAAON,OAAO,CAACkB,MAAM,GAAG,CAAC,GACrB;IACEC,iBAAiB,EAAEjB,KAAK,CAACC,IAAI,CAACH,OAAO,CAAC;IACtCD,EAAE;IACFE;EACF,CAAC,GACD,CAAC,CAAC;AACR,CAAC;AAACmB,OAAA,CAAAtB,iBAAA,GAAAA,iBAAA"}
|