Skip to content

Commit 35147ab

Browse files
committed
wip
1 parent 54526cb commit 35147ab

File tree

4 files changed

+88
-1
lines changed

4 files changed

+88
-1
lines changed

internal/const.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ var isSpecialElementMap = map[string]bool{
7575
"script": true,
7676
"section": true,
7777
"select": true,
78-
"selectedcontent": true,
7978
"source": true,
8079
"style": true,
8180
"summary": true,

internal/parser.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,14 @@ func inBodyIM(p *parser) bool {
14181418
return true
14191419
}
14201420
default:
1421+
// Special handling for selectedcontent as a void element
1422+
if p.tok.Data == "selectedcontent" {
1423+
p.reconstructActiveFormattingElements()
1424+
p.addElement()
1425+
p.oe.pop()
1426+
p.acknowledgeSelfClosingTag()
1427+
return true
1428+
}
14211429
p.reconstructActiveFormattingElements()
14221430
p.addElement()
14231431
if p.hasSelfClosingToken {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[TestPrinter/selectedcontent_element_in_customizable_select - 1]
2+
## Input
3+
4+
```
5+
<select><button><selectedcontent></selectedcontent></button><option>Option 1</option><option>Option 2</option></select>
6+
```
7+
8+
## Output
9+
10+
```js
11+
import {
12+
Fragment,
13+
render as $$render,
14+
createAstro as $$createAstro,
15+
createComponent as $$createComponent,
16+
renderComponent as $$renderComponent,
17+
renderHead as $$renderHead,
18+
maybeRenderHead as $$maybeRenderHead,
19+
unescapeHTML as $$unescapeHTML,
20+
renderSlot as $$renderSlot,
21+
mergeSlots as $$mergeSlots,
22+
addAttribute as $$addAttribute,
23+
spreadAttributes as $$spreadAttributes,
24+
defineStyleVars as $$defineStyleVars,
25+
defineScriptVars as $$defineScriptVars,
26+
renderTransition as $$renderTransition,
27+
createTransitionScope as $$createTransitionScope,
28+
renderScript as $$renderScript,
29+
createMetadata as $$createMetadata
30+
} from "http://localhost:3000/";
31+
32+
export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: new Set([]), hoisted: [] });
33+
34+
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
35+
36+
return $$render`${$$maybeRenderHead($$result)}<select><button><selectedcontent><option>Option 1</option><option>Option 2</option></button></select>`;
37+
}, undefined, undefined);
38+
export default $$Component;
39+
```
40+
---
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[TestPrinter/selectedcontent_self-closing_element - 1]
2+
## Input
3+
4+
```
5+
<select><button><selectedcontent /></button><option>Option 1</option><option>Option 2</option></select>
6+
```
7+
8+
## Output
9+
10+
```js
11+
import {
12+
Fragment,
13+
render as $$render,
14+
createAstro as $$createAstro,
15+
createComponent as $$createComponent,
16+
renderComponent as $$renderComponent,
17+
renderHead as $$renderHead,
18+
maybeRenderHead as $$maybeRenderHead,
19+
unescapeHTML as $$unescapeHTML,
20+
renderSlot as $$renderSlot,
21+
mergeSlots as $$mergeSlots,
22+
addAttribute as $$addAttribute,
23+
spreadAttributes as $$spreadAttributes,
24+
defineStyleVars as $$defineStyleVars,
25+
defineScriptVars as $$defineScriptVars,
26+
renderTransition as $$renderTransition,
27+
createTransitionScope as $$createTransitionScope,
28+
renderScript as $$renderScript,
29+
createMetadata as $$createMetadata
30+
} from "http://localhost:3000/";
31+
32+
export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: new Set([]), hoisted: [] });
33+
34+
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
35+
36+
return $$render`${$$maybeRenderHead($$result)}<select><button><selectedcontent><option>Option 1</option><option>Option 2</option></button></select>`;
37+
}, undefined, undefined);
38+
export default $$Component;
39+
```
40+
---

0 commit comments

Comments
 (0)