0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 17:00:40 +01:00

Merge pull request #517 from sveltejs/gh-516

Replace invalid characters in element names when creating variables
This commit is contained in:
Conduitry 2017-04-20 15:02:30 -04:00 committed by GitHub
commit a09605264f
3 changed files with 8 additions and 2 deletions

View File

@ -34,7 +34,7 @@ export default function visitElement ( generator, block, state, node ) {
return visitComponent( generator, block, state, node );
}
const name = block.getUniqueName( node.name );
const name = block.getUniqueName( node.name.replace( /[^a-zA-Z_$]/g, '_' ) );
const childState = Object.assign( {}, state, {
isTopLevel: false,
@ -136,4 +136,4 @@ function getRenderStatement ( generator, namespace, name ) {
}
return `${generator.helper( 'createElement' )}( '${name}' )`;
}
}

View File

@ -0,0 +1,5 @@
export default {
html: `
<foo-bar>Hello</foo-bar>
`
}

View File

@ -0,0 +1 @@
<foo-bar>Hello</foo-bar>