Skip to content

Vue 2 removes former event listeners #3587

@Grafikart

Description

@Grafikart

I'm currently trying VueJS 2 and noticed a change when using it on existing DOM
Indeed everytime VueJS is initialised it will do something on existing DOM and will remove events previously binded outside of VueJS.

// We bind an event
document.querySelector('#demo').addEventListener('click', function () {
    alert("i'm a button")
})

// and it's lost when Vue is binded
new Vue({
    el: '#vuejs'
})

JSFiddle

This same example works fine with VueJS1. I don't have enough understanding of Vue core to understand what changed between the two version of the compiler.js that would explain this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions