pull/15538/head
Rich Harris 4 months ago
parent 7edf0c2c18
commit 941f266827

@ -21,15 +21,9 @@ function build(item) {
case 'element': {
const element = b.object([b.prop('init', b.id('e'), b.literal(item.name))]);
if (item.attributes.is) {
element.properties.push(b.prop('init', b.id('is'), b.literal(item.attributes.is)));
}
const attributes = b.prop('init', b.id('p'), b.object([]));
for (const key in item.attributes) {
if (key === 'is') continue;
const value = item.attributes[key];
attributes.value.properties.push(

@ -78,7 +78,7 @@ export function template(content, flags) {
}
/**
* @typedef {{e: string, is?: string, p: Record<string, string>, c: Array<TemplateStructure>} | undefined | string | [string]} TemplateStructure
* @typedef {{e: string, p: Record<string, string>, c: Array<TemplateStructure>} | undefined | string | [string]} TemplateStructure
*/
/**
@ -102,7 +102,7 @@ function structure_to_fragment(structure, ns) {
/** @type {NAMESPACE_SVG | NAMESPACE_MATHML | undefined} */
let namespace = item.e === 'svg' ? NAMESPACE_SVG : item.e === 'math' ? NAMESPACE_MATHML : ns;
var element = create_element(item.e, namespace, item.is);
var element = create_element(item.e, namespace, item.p?.is);
for (var key in item.p) {
set_attribute(element, key, item.p[key]);

Loading…
Cancel
Save