Skip to content

Commit d3949a6

Browse files
fix: hr, script and template as valid select children (#11344)
Closes #11342 --------- Co-authored-by: Jeremiasz Major <[email protected]>
1 parent cd79807 commit d3949a6

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

.changeset/cyan-squids-drive.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte": patch
3+
---
4+
5+
fix: make hr, script and template valid select children

packages/svelte/src/constants.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,14 @@ export function is_tag_valid_with_parent(tag, parent_tag) {
158158
switch (parent_tag) {
159159
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
160160
case 'select':
161-
return tag === 'option' || tag === 'optgroup' || tag === '#text';
161+
return (
162+
tag === 'option' ||
163+
tag === 'optgroup' ||
164+
tag === '#text' ||
165+
tag === 'hr' ||
166+
tag === 'script' ||
167+
tag === 'template'
168+
);
162169
case 'optgroup':
163170
return tag === 'option' || tag === '#text';
164171
// Strictly speaking, seeing an <option> doesn't mean we're in a <select>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script>
2+
</script>
3+
4+
<select>
5+
<option value="0">The</option>
6+
<hr>
7+
<script>
8+
console.log("hei");
9+
</script>
10+
<template>Cool</template>
11+
<option value="1">bug</option>
12+
</select>

0 commit comments

Comments
 (0)