replace invalid characters in element names when creating variables (#516)

pull/517/head
Conduitry 8 years ago
parent 3dafc39a05
commit 2bc223a936

@ -34,7 +34,7 @@ export default function visitElement ( generator, block, state, node ) {
return visitComponent( 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, { const childState = Object.assign( {}, state, {
isTopLevel: false, isTopLevel: false,
@ -136,4 +136,4 @@ function getRenderStatement ( generator, namespace, name ) {
} }
return `${generator.helper( 'createElement' )}( '${name}' )`; return `${generator.helper( 'createElement' )}( '${name}' )`;
} }

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