|
|
@ -110,11 +110,16 @@ export function build_element_attributes(node, context) {
|
|
|
|
if (binding?.omit_in_ssr) continue;
|
|
|
|
if (binding?.omit_in_ssr) continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (is_content_editable_binding(attribute.name)) {
|
|
|
|
if (is_content_editable_binding(attribute.name)) {
|
|
|
|
content = /** @type {Expression} */ (context.visit(attribute.expression));
|
|
|
|
content =
|
|
|
|
|
|
|
|
attribute.expression.type === 'SequenceExpression'
|
|
|
|
|
|
|
|
? b.call(/** @type {Expression} */ (context.visit(attribute.expression.expressions[0])))
|
|
|
|
|
|
|
|
: /** @type {Expression} */ (context.visit(attribute.expression));
|
|
|
|
} else if (attribute.name === 'value' && node.name === 'textarea') {
|
|
|
|
} else if (attribute.name === 'value' && node.name === 'textarea') {
|
|
|
|
content = b.call(
|
|
|
|
content = b.call(
|
|
|
|
'$.escape',
|
|
|
|
'$.escape',
|
|
|
|
/** @type {Expression} */ (context.visit(attribute.expression))
|
|
|
|
attribute.expression.type === 'SequenceExpression'
|
|
|
|
|
|
|
|
? b.call(/** @type {Expression} */ (context.visit(attribute.expression.expressions[0])))
|
|
|
|
|
|
|
|
: /** @type {Expression} */ (context.visit(attribute.expression))
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else if (attribute.name === 'group') {
|
|
|
|
} else if (attribute.name === 'group') {
|
|
|
|
const value_attribute = /** @type {AST.Attribute | undefined} */ (
|
|
|
|
const value_attribute = /** @type {AST.Attribute | undefined} */ (
|
|
|
@ -129,6 +134,11 @@ export function build_element_attributes(node, context) {
|
|
|
|
is_text_attribute(attr) &&
|
|
|
|
is_text_attribute(attr) &&
|
|
|
|
attr.value[0].data === 'checkbox'
|
|
|
|
attr.value[0].data === 'checkbox'
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
const attribute_expression =
|
|
|
|
|
|
|
|
attribute.expression.type === 'SequenceExpression'
|
|
|
|
|
|
|
|
? b.call(attribute.expression.expressions[0])
|
|
|
|
|
|
|
|
: attribute.expression;
|
|
|
|
|
|
|
|
|
|
|
|
attributes.push(
|
|
|
|
attributes.push(
|
|
|
|
create_attribute('checked', -1, -1, [
|
|
|
|
create_attribute('checked', -1, -1, [
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -138,12 +148,12 @@ export function build_element_attributes(node, context) {
|
|
|
|
parent: attribute,
|
|
|
|
parent: attribute,
|
|
|
|
expression: is_checkbox
|
|
|
|
expression: is_checkbox
|
|
|
|
? b.call(
|
|
|
|
? b.call(
|
|
|
|
b.member(attribute.expression, 'includes'),
|
|
|
|
b.member(attribute_expression, 'includes'),
|
|
|
|
build_attribute_value(value_attribute.value, context)
|
|
|
|
build_attribute_value(value_attribute.value, context)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: b.binary(
|
|
|
|
: b.binary(
|
|
|
|
'===',
|
|
|
|
'===',
|
|
|
|
attribute.expression,
|
|
|
|
attribute_expression,
|
|
|
|
build_attribute_value(value_attribute.value, context)
|
|
|
|
build_attribute_value(value_attribute.value, context)
|
|
|
|
),
|
|
|
|
),
|
|
|
|
metadata: {
|
|
|
|
metadata: {
|
|
|
@ -153,6 +163,11 @@ export function build_element_attributes(node, context) {
|
|
|
|
])
|
|
|
|
])
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
const attribute_expression =
|
|
|
|
|
|
|
|
attribute.expression.type === 'SequenceExpression'
|
|
|
|
|
|
|
|
? b.call(attribute.expression.expressions[0])
|
|
|
|
|
|
|
|
: attribute.expression;
|
|
|
|
|
|
|
|
|
|
|
|
attributes.push(
|
|
|
|
attributes.push(
|
|
|
|
create_attribute(attribute.name, -1, -1, [
|
|
|
|
create_attribute(attribute.name, -1, -1, [
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -160,7 +175,7 @@ export function build_element_attributes(node, context) {
|
|
|
|
start: -1,
|
|
|
|
start: -1,
|
|
|
|
end: -1,
|
|
|
|
end: -1,
|
|
|
|
parent: attribute,
|
|
|
|
parent: attribute,
|
|
|
|
expression: attribute.expression,
|
|
|
|
expression: attribute_expression,
|
|
|
|
metadata: {
|
|
|
|
metadata: {
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
expression: create_expression_metadata()
|
|
|
|
}
|
|
|
|
}
|
|
|
|