fix: hr, script and template as valid select children (#11344)

Closes #11342
---------

Co-authored-by: Jeremiasz Major <jrh.mjr@gmail.com>
pull/11364/head
Paolo Ricciuti 2 months ago committed by GitHub
parent cd798077b4
commit d3949a6e71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: make hr, script and template valid select children

@ -158,7 +158,14 @@ export function is_tag_valid_with_parent(tag, parent_tag) {
switch (parent_tag) {
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
case 'select':
return tag === 'option' || tag === 'optgroup' || tag === '#text';
return (
tag === 'option' ||
tag === 'optgroup' ||
tag === '#text' ||
tag === 'hr' ||
tag === 'script' ||
tag === 'template'
);
case 'optgroup':
return tag === 'option' || tag === '#text';
// Strictly speaking, seeing an <option> doesn't mean we're in a <select>

@ -0,0 +1,12 @@
<script>
</script>
<select>
<option value="0">The</option>
<hr>
<script>
console.log("hei");
</script>
<template>Cool</template>
<option value="1">bug</option>
</select>
Loading…
Cancel
Save