@schukai/monster 3.21.0 → 3.22.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/source/dom/updater.mjs +23 -6
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
package/package.json
CHANGED
package/source/dom/updater.mjs
CHANGED
@@ -514,11 +514,19 @@ function insertElement(change) {
|
|
514
514
|
}
|
515
515
|
}
|
516
516
|
|
517
|
-
|
518
|
-
|
517
|
+
/**
|
518
|
+
* @private
|
519
|
+
* @param container
|
520
|
+
* @param key
|
521
|
+
* @param ref
|
522
|
+
* @param path
|
523
|
+
* @returns {any}
|
524
|
+
*/
|
525
|
+
function internalTemplateLookUp(container, key, ref, path) {
|
526
|
+
|
519
527
|
let templateID = key;
|
520
528
|
let template;
|
521
|
-
|
529
|
+
|
522
530
|
if (container.hasAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID)) {
|
523
531
|
templateID = container.getAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID);
|
524
532
|
template = findDocumentTemplate(templateID, container);
|
@@ -526,7 +534,7 @@ function findTemplate(container, key, ref, path) {
|
|
526
534
|
return template;
|
527
535
|
}
|
528
536
|
}
|
529
|
-
|
537
|
+
|
530
538
|
if (container.closest(`[${ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID}]`)) {
|
531
539
|
templateID = container.closest(`[${ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID}]`).getAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID);
|
532
540
|
template = findDocumentTemplate(templateID, container);
|
@@ -535,6 +543,15 @@ function findTemplate(container, key, ref, path) {
|
|
535
543
|
}
|
536
544
|
}
|
537
545
|
|
546
|
+
const rootNode = container.getRootNode();
|
547
|
+
if (rootNode instanceof ShadowRoot) {
|
548
|
+
templateID = rootNode.host.getAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID);
|
549
|
+
template = findDocumentTemplate(templateID, container);
|
550
|
+
if (template instanceof HTMLTemplateElement) {
|
551
|
+
return template;
|
552
|
+
}
|
553
|
+
}
|
554
|
+
|
538
555
|
return findDocumentTemplate(templateID, container);
|
539
556
|
}
|
540
557
|
|
@@ -551,8 +568,8 @@ function findTemplate(container, key, ref, path) {
|
|
551
568
|
*/
|
552
569
|
function appendNewDocumentFragment(container, key, ref, path) {
|
553
570
|
|
554
|
-
let template =
|
555
|
-
|
571
|
+
let template = internalTemplateLookUp(container, key, ref, path);
|
572
|
+
|
556
573
|
let nodes = template.createDocumentFragment();
|
557
574
|
for (const [, node] of Object.entries(nodes.childNodes)) {
|
558
575
|
if (node instanceof HTMLElement) {
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED