Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Model binding breaks when using jQuery <1.7 #2199
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 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
I dunno if I agree with adding support for jQuery < 1.7. That version is already over 4 years old (as you mentioned). Since there are very few BC breaks between 1.6 and 1.7, it should be reasonable to upgrade the jQuery version in any project using VueJS (or, just go without jQuery at all, if that's possible).
I encountered this scenario the other day when I was tasked to introduce a new feature into an existing legacy system. That legacy system was working with jQuery 1.5.x, and it was dependent on
@young-steveo mentions that you should go without jQuery completely if it's possible. As described in my situation, it was beyond my control. I'm not necessarily advocating that Vue should support legacy versions of jQuery, but since Vue works just fine without jQuery, I feel that it should fail gracefully if jQuery exists and