Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cyan-squids-drive.md
@@ -0,0 +1,5 @@
---
"svelte": patch
---

hr, script and template as valid select children
paoloricciuti marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 8 additions & 1 deletion packages/svelte/src/constants.js
Expand Up @@ -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>
Expand Down
@@ -0,0 +1 @@
[]
@@ -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>