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

pull/12821/head
paoloricciuti 2 years ago
parent c2fb1a6df1
commit 71cdb1d333

@ -0,0 +1,5 @@
---
'svelte': patch
---
feat: treat tag with `[` as a component, even if lowercase

@ -74,7 +74,7 @@ function parent_is_shadowroot_template(stack) {
const regex_closing_textarea_tag = /^<\/textarea(\s[^>]*)?>/i;
const regex_closing_comment = /-->/;
const regex_component_name = /^(?:[A-Z]|[A-Za-z][A-Za-z0-9_$]*\.)/;
const regex_component_name = /^(?:[A-Z]|[A-Za-z][A-Za-z0-9_$]*(?:\.|\[))/;
/** @param {Parser} parser */
export default function element(parser) {

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

@ -2,6 +2,14 @@
import child from './child.svelte';
const components = { child };
const arr = [child];
const mixed = [components];
</script>
<components.child />
<arr[0] />
<mixed[0].child />

Loading…
Cancel
Save