Files
parcoursup/node_modules/@riotjs/dom-bindings/src/util/create-template-meta.js

20 lines
638 B
JavaScript
Raw Normal View History

2023-03-05 13:23:23 +01:00
import createHeadTailPlaceholders from './create-head-tail-placeholders'
/**
* Create the template meta object in case of <template> fragments
* @param {TemplateChunk} componentTemplate - template chunk object
* @returns {Object} the meta property that will be passed to the mount function of the TemplateChunk
*/
export default function createTemplateMeta(componentTemplate) {
const fragment = componentTemplate.dom.cloneNode(true)
const {head, tail} = createHeadTailPlaceholders()
return {
avoidDOMInjection: true,
fragment,
head,
tail,
children: [head, ...Array.from(fragment.childNodes), tail]
}
}