-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Description
If jQuery is being used on the same page as Vue, it appears that Vue has a dependency on jQuery 1.7 or above. The reason for the dependency is illustrated here (from the Vue source http://vuejs.org/js/vue.js):
this.hasjQuery = typeof jQuery === 'function';
if (this.hasjQuery) {
jQuery(el).on('change', this.listener);
if (!lazy) {
jQuery(el).on('input', this.listener);
}
} else {
this.on('change', this.listener);
if (!lazy) {
this.on('input', this.listener);
}
}
This code makes the assumption that if jQuery is available, then the jQuery.on method is also available. According to the jQuery API, this method was first introduced in 1.7 (http://api.jquery.com/on/).
Here's an example of the scenario I'm describing: https://jsbin.com/darawa/edit?html,js,console,output
You can see that we get an error because we're using jQuery 1.6.4.
I'm not sure if it's reasonable to make the assumption that the included jQuery has the on method available (e.g. they're using 1.7 or newer). I realize 1.7 is quite old, but at the very least I think we could handle this scenario more gracefully.