diff --git a/src/generators/dom/visitors/Element/Binding.ts b/src/generators/dom/visitors/Element/Binding.ts index fdac104a8743..fb7f72a7cc3e 100644 --- a/src/generators/dom/visitors/Element/Binding.ts +++ b/src/generators/dom/visitors/Element/Binding.ts @@ -160,7 +160,7 @@ export default function visitBinding( } ${generator.helper( - 'addEventListener' + 'addListener' )}( ${state.parentNode}, '${eventName}', ${handler} ); `); @@ -178,19 +178,19 @@ export default function visitBinding( block.builders.destroy.addLine(deindent` ${generator.helper( - 'removeEventListener' + 'removeListener' )}( ${state.parentNode}, '${eventName}', ${handler} ); `); if (attribute.name === 'paused') { block.builders.create.addLine( `${generator.helper( - 'addEventListener' + 'addListener' )}( ${state.parentNode}, 'play', ${handler} );` ); block.builders.destroy.addLine( `${generator.helper( - 'removeEventListener' + 'removeListener' )}( ${state.parentNode}, 'play', ${handler} );` ); } diff --git a/src/generators/dom/visitors/Element/EventHandler.ts b/src/generators/dom/visitors/Element/EventHandler.ts index 660e64e39584..dca64561fde4 100644 --- a/src/generators/dom/visitors/Element/EventHandler.ts +++ b/src/generators/dom/visitors/Element/EventHandler.ts @@ -99,13 +99,13 @@ export default function visitEventHandler( } else { block.builders.create.addLine(deindent` ${generator.helper( - 'addEventListener' + 'addListener' )}( ${state.parentNode}, '${name}', ${handlerName} ); `); block.builders.destroy.addLine(deindent` ${generator.helper( - 'removeEventListener' + 'removeListener' )}( ${state.parentNode}, '${name}', ${handlerName} ); `); } diff --git a/src/shared/dom.js b/src/shared/dom.js index 11f178317b4b..fba7af93d4d1 100644 --- a/src/shared/dom.js +++ b/src/shared/dom.js @@ -39,11 +39,11 @@ export function createComment() { return document.createComment(''); } -export function addEventListener(node, event, handler) { +export function addListener(node, event, handler) { node.addEventListener(event, handler, false); } -export function removeEventListener(node, event, handler) { +export function removeListener(node, event, handler) { node.removeEventListener(event, handler, false); }