-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Discuss - Removing jQuery as a hard dependency #980
Comments
👍 Basically what I want is to load something like deferred-js and then use a micro-library like saltjs and not need jQuery :) Would require a bit of polyfilling in Backbone but it will be easier once jashkenas/backbone#3003 lands. N.B. People just default to jQuery straight away for the simplest things when most of us are dealing with modern browsers, I think we need to get out of this habit. I'm also not a fan of jQuery's API. And it's slow. |
On Tue, Mar 4, 2014 at 7:33 PM, Jmeas Smith notifications@github.comwrote:
|
+1 to @brian-mann Topically this sounds like a good idea, however when you understand what these methods are actually doing , you quickly realize the WORLD of trouble you are opening yourself to. I love this google doc that explains how silly http://youmightnotneedjquery.com/ really is, when you consider ditching the all mighty https://docs.google.com/document/d/1LPaPA30bLUB_publLIMF0RlhdnPx_ePXm7oW02iiT6o/edit# nuff` said |
@brian-mann Isn't that because jQuery has it's own internal event bus and data management? If you bind with This is what I gleaned from looking at jQuery source myself. |
Yah. That's true. There are some other items on my mind but I'll research first before throwing out there. Sent from my iPhone
|
I'm all ears @brian-mann but if modern browsers can't add and remove nodes (which is the bulk of what we're doing) without causing memory leaks; I'm gonna give up and switch back to backend dev 😜 |
Anything to add before we merge jashkenas/backbone#3003 ? |
Just wanna throw minifiedjs into here: |
I still think this is viable. @brian-mann, have you had a chance to think more about this? |
I also want to throw this into: However, I suggest just taking the parts that you actually need for Marionette. |
as @akre54 mentioned, this is going to be a problem quite soon for us https://github.com/jashkenas/backbone/wiki/Using-Backbone-without-jQuery So we need to resolve this for 2.x |
I believe it is highly unlikely that this will be resolved by v2. |
ha yeah just we should not bump the backbone dep again until this is. |
As I said, feel free to bump the BB version for whatever reason. This |
I'm wondering if we should add jQuery as a hard dependency until this gets worked out...Marionette now really does rely on jQuery. |
I guess we'll defer this until v3? |
$.defer |
lol yeah I think v3 at the earliest makes sense :P |
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Promise#done() is not part of the standard and has different meanings in different promise libraries. This fixes the Deffered dependency discussed in marionettejs#980. This also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Replaces Promise#done() (not part of the standard) with Promises#then() This fixes the jQuery.Deffered dependency discussed in marionettejs#980. It also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Replaces Promise#done() (not part of the standard) with Promises#then() This fixes the jQuery.Deffered dependency discussed in marionettejs#980. It also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Replaces Promise#done() (not part of the standard) with Promises#then() This fixes the jQuery.Deffered dependency discussed in #980. It also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Replaces Promise#done() (not part of the standard) with Promises#then() This fixes the jQuery.Deffered dependency discussed in #980. It also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Replaces Promise#done() (not part of the standard) with Promises#then() This fixes the jQuery.Deffered dependency discussed in #980. It also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Replaces Promise#done() (not part of the standard) with Promises#then() This fixes the jQuery.Deffered dependency discussed in #980. It also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Replaces Promise#done() (not part of the standard) with Promises#then() This fixes the jQuery.Deffered dependency discussed in #980. It also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Replaces Promise#done() (not part of the standard) with Promises#then() This fixes the jQuery.Deffered dependency discussed in #980. It also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
The first step toward solving this issue was done via #1395. $.Deferred can be swapped for any thenable! |
the slow road ahead 🚜 |
rofl |
Is the general idea going forward to provide a set of hooks a la https://github.com/jashkenas/backbone/wiki/Using-Backbone-without-jQuery, or just use raw DOM access when needed? Right now, there are a few examples of everything throughout the code. It might make sense to consolidate all DOM manipulation to some helper methods to both provide view hooks and remove jQuery. |
Not sure the payoff would be so large vs the time to do this... Perhaps we should ask the question why do we want this |
Good idea. The real problem I want to solve is the mismatch between the dependencies stated in the Backbone/Marionette manifests and the code you find in the library.
This can be frustrating when trying to set things up in a CommonJS environment. I'd like to see our dependencies line up better with the code. There are two solutions I see to this:
Re: @cmaher: either would be fine for me so long as it resolves the above problem. |
|
I think we should provide hooks like Backbone for methods that depend on jQuery functionality (and minimize the ones that do), then default to using Backbone.$. That way they can be overwritten just like Backbone.Native does. I'd like to have an investigation as to what methods currently depend on Backbone.$/jQuery. |
Just did an updated audit of all of the jquery/dom code at the HEAD of Breakdown by fileBehavior
CollectionView
CompositeView
domRefresh
Region
TemplateCache
View
Summary
Going forward
|
Awesome work, @cmaher. Feel free to update the initial message with the latest audit. |
Added to #1796 |
@marionettejs/marionette-core do we need to readdress this? |
x-ref |
This is a place to discuss removing jQuery as a hard dependency. Inspired by a comment @cobbweb made somewhere about doing this for v2.
List of jQuery features used by Marionette
$.Deferred
$(selector)
$el.html()
$el.empty()
$el.append()
Locations of jQuery in the source
Will be updated with exact links soon
$.Deferred
$.empty()
$.html()
$(selector)
$.html()
$.append()
$.html()
$.append()
Seems doable if we wanted to go down this path. I have no opinion on the matter; I'm just fine leaving jQuery the way it is.
The text was updated successfully, but these errors were encountered: