mirror of https://github.com/sveltejs/svelte
gather names during validation, for later deoncflicting (#88)
parent
f94df9fb6d
commit
0e64f26712
@ -0,0 +1,14 @@
|
||||
export default function validateHtml ( validator, html ) {
|
||||
function visit ( node ) {
|
||||
if ( node.type === 'EachBlock' ) {
|
||||
if ( !~validator.names.indexOf( node.context ) ) validator.names.push( node.context );
|
||||
if ( node.index && !~validator.names.indexOf( node.index ) ) validator.names.push( node.index );
|
||||
}
|
||||
|
||||
if ( node.children ) {
|
||||
node.children.forEach( visit );
|
||||
}
|
||||
}
|
||||
|
||||
html.children.forEach( visit );
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{{#each things as thing, index}}
|
||||
<p>{{index}}: {{thing}}</p>
|
||||
{{/each}}
|
@ -0,0 +1,4 @@
|
||||
[
|
||||
"thing",
|
||||
"index"
|
||||
]
|
Loading…
Reference in new issue