diff --git a/src/generators/dom/visitors/Element/Binding.js b/src/generators/dom/visitors/Element/Binding.js index 7e8f38b947..e88fe8df43 100644 --- a/src/generators/dom/visitors/Element/Binding.js +++ b/src/generators/dom/visitors/Element/Binding.js @@ -13,16 +13,17 @@ export default function visitBinding ( generator, block, state, node, attribute if ( !~state.allUsedContexts.indexOf( context ) ) state.allUsedContexts.push( context ); }); - const handler = block.getUniqueName( `${state.parentNode}_change_handler` ); - + const eventName = getBindingEventName( node, attribute ); + const handler = block.getUniqueName( `${state.parentNode}_${eventName}_handler` ); const isMultipleSelect = node.name === 'select' && node.attributes.find( attr => attr.name.toLowerCase() === 'multiple' ); // TODO use getStaticAttributeValue const type = getStaticAttributeValue( node, 'type' ); const bindingGroup = attribute.name === 'group' ? getBindingGroup( generator, keypath ) : null; const value = getBindingValue( generator, block, state, node, attribute, isMultipleSelect, bindingGroup, type ); - const eventName = getBindingEventName( node ); let setter = getSetter({ block, name, keypath, context: '_svelte', attribute, dependencies, value }); - let updateElement; + let updateElement = `${state.parentNode}.${attribute.name} = ${snippet};`; + const lock = block.getUniqueName( `${state.parentNode}_${attribute.name}_updating` ); + let updateCondition = `!${lock}`; //