title: How does Vue overwrite jQuery event listeners
body: <p>I have read that jQuery and Vue tend not to work very well together (see eg. <a href="https://vuejsdevelopers.com/2017/05/20/vue-js-safely-jquery-plugin/" rel="nofollow noreferrer">https://vuejsdevelopers.com/2017/05/20/vue-js-safely-jquery-plugin/</a>). As I have a large jQuery app that I am progressively incorporating Vue into, I'd like to understand what's going on under the hood so I can avoid conflicts.</p>
  
  <p>Here's a simplified test page:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('#a').click(function() {
    alert('a');
  });
  
  $(function() {
    $('#b').click(function() {
      alert('b');
    });
  });
  
  var app = new Vue({
    el: '.container',
    mounted: function() {
      $('#c').click(function() {
        alert('c');
      });
    }
  });
  
  $('#d').click(function() {
    alert('d');
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="container"&gt;
    &lt;button id="a"&gt;a - jQuery immediate&lt;/button&gt;
    &lt;button id="b"&gt;b - jQuery DOM ready&lt;/button&gt;
    &lt;button id="c"&gt;c - jQuery inside Vue mounted&lt;/button&gt;
    &lt;button id="d"&gt;d - jQuery after Vue&lt;/button&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>As you can see, the first (a) event listener gets wiped out by Vue whereas the other three (b - d) continue to work.</p>
  
  <p>My question boils down to, <em>at a technical level, what is Vue doing to (a) which is different from (b) or (d)?</em></p>
  
  <p><strong>CodePen here:</strong> <a href="https://codepen.io/MSCAU/pen/PxzQNq" rel="nofollow noreferrer">https://codepen.io/MSCAU/pen/PxzQNq</a></p>