Skip to content

Commit 59796de

Browse files
authored
fix: handle booleanish popover (#2702)
`<div popover></div>` actually means `<div popover=""></div>` #2688
1 parent ca668e2 commit 59796de

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function handleAttribute(
160160
const attributeValue: TransformationArray = [];
161161

162162
if (attr.value === true) {
163-
attributeValue.push('true');
163+
attributeValue.push(attr.name === 'popover' ? '""' : 'true');
164164
addAttribute(attributeName, attributeValue);
165165
return;
166166
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{ const $$_tnenopmoCemoS0C = __sveltets_2_ensureComponent(SomeComponent); new $$_tnenopmoCemoS0C({ target: __sveltets_2_any(), props: {"relaxed":true,}});}
1+
{ const $$_tnenopmoCemoS0C = __sveltets_2_ensureComponent(SomeComponent); new $$_tnenopmoCemoS0C({ target: __sveltets_2_any(), props: {"relaxed":true,}});}
2+
{ svelteHTML.createElement("input", {"disabled":true,});}
3+
4+
5+
{ svelteHTML.createElement("div", {"popover":"",}); }
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
<SomeComponent relaxed />
1+
<SomeComponent relaxed />
2+
<input disabled>
3+
4+
<!-- special: this actually means popover="" -->
5+
<div popover></div>

0 commit comments

Comments
 (0)