(element: RendererNode | null, withoutSlots = false)
| 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 | */ |
| 122 | export 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 | |
| 136 | function getFragmentChildren (element: RendererNode | null, blocks: string[] = [], withoutSlots = false) { |
| 137 | if (element && element.nodeName) { |
no test coverage detected
searching dependent graphs…