MCPcopy
hub / github.com/nuxt/nuxt / getFragmentHTML

Function getFragmentHTML

packages/nuxt/src/app/components/utils.ts:122–134  ·  view source on GitHub ↗
(element: RendererNode | null, withoutSlots = false)

Source from the content-addressed store, hash-verified

120 * @returns {string[]|undefined} An array of string which represent the content of each element. Use `.join('')` to retrieve a component vnode.el HTML
121 */
122export function getFragmentHTML (element: RendererNode | null, withoutSlots = false): string[] | undefined {
123 if (element) {
124 if (element.nodeName === '#comment' && element.nodeValue === '[') {
125 return getFragmentChildren(element, [], withoutSlots)
126 }
127 if (withoutSlots) {
128 const clone = element.cloneNode(true)
129 clone.querySelectorAll('[data-island-slot]').forEach((n: Element) => { n.innerHTML = '' })
130 return [clone.outerHTML]
131 }
132 return [element.outerHTML]
133 }
134}
135
136function getFragmentChildren (element: RendererNode | null, blocks: string[] = [], withoutSlots = false) {
137 if (element && element.nodeName) {

Callers 2

setupFunction · 0.90
elToStaticVNodeFunction · 0.85

Calls 1

getFragmentChildrenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…