Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Remove jQuery logic branching #777

Closed
akre54 opened this issue Mar 9, 2014 · 5 comments
Closed

Remove jQuery logic branching #777

akre54 opened this issue Mar 9, 2014 · 5 comments

Comments

@akre54
Copy link
Contributor

akre54 commented Mar 9, 2014

@molily @paulmillr @mehcode Backbone#3003 is about to land in master, bringing with it a new delegate method on View, which will allow us to get rid of some of the jQuery logic branching. Is there anything else you think needs to get added to Backbone to help Chaplin reduce some code around its jQuery dependency?

I think we should always operate with native DOM methods on on the view's el property unless the jQuery method is significantly better in older browsers and rewriting code to target the older browsers would be too much of a pain.

Also, do we need an undelegate method? Layout uses it for click handling. If we do, how many of jQuery's features do we need to support as a baseline here?

@paulmillr
Copy link
Contributor

undelegate is useful as an counterpart of delegate. What can be the alternative?

No-jQuery worked fine for me for a long time. I don't know what we really need from this method

@akre54
Copy link
Contributor Author

akre54 commented Mar 11, 2014

I'm saying that with Backbone adding delegate and undelegate we can remove them here. No need to keep around extra code.

NativeView solution is more flexible than an all-or-nothing jQuery or no jQuery branching. Just use native methods for everything except events, which uses delegate and undelegate.

@paulmillr
Copy link
Contributor

sounds reasonable. we can remove them and test how many tests are passing withbb

@akre54
Copy link
Contributor Author

akre54 commented Mar 12, 2014

I pulled in Backbone from my view-native-hooks branch and got rid of the the delegate and undelegate methods from Chaplin. The delegate tests pass with only two issues (one relating to throwing), and two noWrap issues:

>> View - should not wrap el with `tagName` when using a region
>> Message: 'undefined' is not a function (evaluating 'name.toLowerCase()')

>> View - should not wrap el with `tagName`
>> Message: 'undefined' is not a function (evaluating 'name.toLowerCase()')

>> View - should register and remove user input event handlers
>> Message: expected 2 to equal 1

@akre54
Copy link
Contributor Author

akre54 commented Mar 18, 2014

BB#3003 is merged, closing in favor of #780

@akre54 akre54 closed this as completed Mar 18, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants