-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing jQuery (upcoming PR) #8
Comments
Hey! Love that you did this. That said, I do already have a plan for how to remove the jQuery dependency. It will be similar to Backbone.$. By default, Boba will try and use Boba.$ = {
extend: function(target, object) { ... },
on: function(element, event, selector, handler) { ... },
proxy: function(func, context) { ... }
} If you're using Underscore.js, you could use something like this: Boba.$ = {
extend: _.extend,
proxy: _.bind,
// Underscore doesn't have anything for this, we'd have to write it ourselves
on: function(element, event, selector, handler) { ... }
} The Boba.$.on = function(el) {
Boba.$.fn.on.apply($(el), Array.prototype.splice.call(arguments, 1))
} The point is, I don't want Boba to include ancillary functions. I'd rather have a I'd love to hear other people's thoughts! |
My first thought as a developer is, "Yeah, shims would be cool!", but my first thought as a user is, "Why can't it just work OOTB?" The level of complexity necessary to hide a loop and a closure is crazy. And you still don't get a good listener for Boba tries to make working with GA easier, right? IMO, supplanting the user's problem (tracking) with writing extra methods just to get it to work seems dubious. |
Oh, it would work out of the box with jQuery, and there would be other versions (in a |
Sorry, I probably didn't explain very well before. Boba at it's core would use jQuery if present, and require a shim otherwise. The shims would live in a |
It's up to you ultimately how you want to do it. I think it's a bit silly to shim a for loop and a closure. There's nothing wrong with these patterns or having them in the core code. The complexity created by offloading to dependency x creates far more friction for maintenance/contributors and end users. Suddenly it becomes not an easy drop in replacement-- you need to know something about it, you need to pick the right shim and be aware of potential conflicts. For a 100-line abstraction, that kind of peripheral knowledge shouldn't be a prerequisite. |
An idea could be to stick mainly to ES5 methods, such as |
I think I'm just going to merge this (when you submit the PR). Eventually I'll get around to implementing things the way I'd like them, but this is good for now. |
Re #5, I have refactored to remove the jQuery dependency, but I'm not sure how to really go about testing it. It would be great if you could review my branch. I'd be happy to send a PR if you're good with it.
The text was updated successfully, but these errors were encountered: