|
|
@ -9,7 +9,7 @@ export function get_class_attribute_value(attribute: Attribute): ESTreeExpressio
|
|
|
|
// handle special case — `class={possiblyUndefined}` with scoped CSS
|
|
|
|
// handle special case — `class={possiblyUndefined}` with scoped CSS
|
|
|
|
if (attribute.chunks.length === 2 && (attribute.chunks[1] as Text).synthetic) {
|
|
|
|
if (attribute.chunks.length === 2 && (attribute.chunks[1] as Text).synthetic) {
|
|
|
|
const value = (attribute.chunks[0] as Expression).node;
|
|
|
|
const value = (attribute.chunks[0] as Expression).node;
|
|
|
|
return x`@escape(@null_to_empty(${value})) + "${(attribute.chunks[1] as Text).data}"`;
|
|
|
|
return x`@escape(@null_to_empty(${value}), true) + "${(attribute.chunks[1] as Text).data}"`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return get_attribute_value(attribute);
|
|
|
|
return get_attribute_value(attribute);
|
|
|
@ -22,7 +22,7 @@ export function get_attribute_value(attribute: Attribute): ESTreeExpression {
|
|
|
|
.map((chunk) => {
|
|
|
|
.map((chunk) => {
|
|
|
|
return chunk.type === 'Text'
|
|
|
|
return chunk.type === 'Text'
|
|
|
|
? string_literal(chunk.data.replace(/"/g, '"')) as ESTreeExpression
|
|
|
|
? string_literal(chunk.data.replace(/"/g, '"')) as ESTreeExpression
|
|
|
|
: x`@escape(${chunk.node})`;
|
|
|
|
: x`@escape(${chunk.node}, true)`;
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.reduce((lhs, rhs) => x`${lhs} + ${rhs}`);
|
|
|
|
.reduce((lhs, rhs) => x`${lhs} + ${rhs}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|