feat: treat tag with `.` as a component, even if lowercase

pull/12798/head
Rich Harris 2 years ago
parent 09db33979d
commit 33c91a6b75

@ -74,7 +74,7 @@ function parent_is_shadowroot_template(stack) {
const regex_closing_textarea_tag = /^<\/textarea(\s[^>]*)?>/i;
const regex_closing_comment = /-->/;
const regex_capital_letter = /[A-Z]/;
const component_name = /^(?:[A-Z]|[A-Za-z][A-Za-z0-9_$]*\.)/;
/** @param {Parser} parser */
export default function element(parser) {
@ -127,7 +127,7 @@ export default function element(parser) {
const type = meta_tags.has(name)
? meta_tags.get(name)
: regex_capital_letter.test(name[0])
: component_name.test(name)
? 'Component'
: name === 'title' && parent_is_head(parser.stack)
? 'TitleElement'

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
html: '<h1>hello</h1>'
});

@ -0,0 +1,7 @@
<script>
import child from './child.svelte';
const components = { child };
</script>
<components.child />
Loading…
Cancel
Save