pull/15538/head
Rich Harris 4 months ago
parent 84f15d005c
commit 1be912071d

@ -14,8 +14,14 @@ export function template_to_string(items) {
* @param {Node} node
*/
function stringify(node) {
switch (node.type) {
case 'element': {
if (node.type === 'text') {
return node.nodes.map((node) => node.raw).join('');
}
if (node.type === 'anchor') {
return node.data ? `<!--${node.data}-->` : '<!>';
}
let str = `<${node.name}`;
for (const key in node.attributes) {
@ -33,14 +39,4 @@ function stringify(node) {
}
return str;
}
case 'text': {
return node.nodes.map((node) => node.raw).join('');
}
case 'anchor': {
return node.data ? `<!--${node.data}-->` : '<!>';
}
}
}

Loading…
Cancel
Save