Skip to content

Commit 5eaec30

Browse files
committed
simplify
1 parent a6b3f4e commit 5eaec30

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,17 +229,16 @@ export function RegularElement(node, context) {
229229
(attribute.value === true || is_text_attribute(attribute))
230230
) {
231231
const name = get_attribute_name(node, attribute, context);
232-
const literal_value = /** @type {Literal} */ (
233-
build_attribute_value(attribute.value, context).value
234-
).value;
235-
if (name !== 'class' || literal_value) {
232+
const value = is_text_attribute(attribute) ? attribute.value[0].data : true;
233+
234+
if (name !== 'class' || value) {
236235
// TODO namespace=foreign probably doesn't want to do template stuff at all and instead use programmatic methods
237236
// to create the elements it needs.
238237
context.state.template.push(
239238
` ${attribute.name}${
240-
is_boolean_attribute(name) && literal_value === true
239+
is_boolean_attribute(name) && value === true
241240
? ''
242-
: `="${literal_value === true ? '' : escape_html(literal_value, true)}"`
241+
: `="${value === true ? '' : escape_html(value, true)}"`
243242
}`
244243
);
245244
continue;

0 commit comments

Comments
 (0)