Merge pull request #503 from sveltejs/restart-audio

prevent bindings interfering with each other on the same element
pull/506/head
Rich Harris 8 years ago committed by GitHub
commit cf86d8cff6

@ -22,7 +22,7 @@ export default function visitBinding ( generator, block, state, node, attribute
let setter = getSetter({ block, name, context: '_svelte', attribute, dependencies, value }); let setter = getSetter({ block, name, context: '_svelte', attribute, dependencies, value });
let updateElement = `${state.parentNode}.${attribute.name} = ${snippet};`; let updateElement = `${state.parentNode}.${attribute.name} = ${snippet};`;
const lock = block.getUniqueName( `${state.parentNode}_${attribute.name}_updating` ); const lock = block.alias( `${state.parentNode}_updating` );
let updateCondition = `!${lock}`; let updateCondition = `!${lock}`;
// <select> special case // <select> special case
@ -103,7 +103,7 @@ export default function visitBinding ( generator, block, state, node, attribute
const last = block.getUniqueName( `${state.parentNode}_paused_value` ); const last = block.getUniqueName( `${state.parentNode}_paused_value` );
block.builders.create.addLine( `var ${last} = true;` ); block.builders.create.addLine( `var ${last} = true;` );
updateCondition += ` && ${last} !== ( ${last} = ${snippet} )`; updateCondition = `${last} !== ( ${last} = ${snippet} )`;
updateElement = `${state.parentNode}[ ${last} ? 'pause' : 'play' ]();`; updateElement = `${state.parentNode}[ ${last} ? 'pause' : 'play' ]();`;
} }
} }

Loading…
Cancel
Save