import deindent from '../../../utils/deindent.js'; import isReference from '../../../utils/isReference.js'; import flattenReference from '../../../utils/flattenReference.js'; export default function createBinding ( generator, node, attribute, current, local ) { const parts = attribute.value.split( '.' ); const deep = parts.length > 1; const contextual = parts[0] in current.contexts; if ( contextual ) local.allUsedContexts.add( parts[0] ); const handler = current.counter( `${local.name}ChangeHandler` ); let setter; let eventName = 'change'; if ( node.name === 'input' ) { const type = node.attributes.find( attr => attr.type === 'Attribute' && attr.name === 'type' ); if ( !type || type.value[0].data === 'text' ) { // TODO in validation, should throw if type attribute is not static eventName = 'input'; } } let value; if ( local.isComponent ) { value = 'value'; } else if ( node.name === 'select' ) { // TODO