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

Bb view hooks #780

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open

Bb view hooks #780

wants to merge 26 commits into from

Conversation

akre54
Copy link
Contributor

@akre54 akre54 commented Mar 18, 2014

Basic gist:

  • Use native methods where possible (prefer @el to @$el in library code like Chaplin).
  • view.$ now returns an array-like (has numeric length) object, meaning use view.$(selector)[0] to get an el instance, or for el in view.$(selector) for a list (dont rely on auto jquery each differences.
  • Lastly, Backbone adds a delegate method that allows us to replace direct calls to $el.on, and more importantly allows us to remove the delegateEvents workaround. We no longer need a keepOld param since we can just call delegate directly without blowing away old ones with undelegateEvents each time.

Still some tests failing.

@@ -15,7 +15,7 @@ filterChildren = (nodeList, selector) ->

toggleElement = do ->
if $
(elem, visible) -> elem.toggle visible
(elem, visible) -> $(elem).toggle visible
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downside of always passing a non-jq wrapped element is that we have to re-wrap it. jQuery methods like toggle aren't easily recreated in native code so easiest to leave them around.

For things like addClass, it may make sense to force people to provide a polyfill if they need older browsers.

@paulmillr
Copy link
Contributor

tests are not passing

@akre54
Copy link
Contributor Author

akre54 commented Mar 19, 2014

Working on it

@akre54 akre54 mentioned this pull request May 14, 2015
@@ -6,12 +6,13 @@
"expect": "0.2.x",
"jquery": "1.9.x",
"lodash": "2.3.x",
"backbone": "1.1.x",
"backbone": "git://github.com/jashkenas/backbone#3994c1cb8592c7e30613e9f869fe60c1cdce6164",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? Is it unstable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah we have to fix that. Should read >1.2.0 now

On Mon, May 18, 2015, 21:55 Paul Miller notifications@github.com wrote:

In bower.json
#780 (comment):

@@ -6,12 +6,13 @@
"expect": "0.2.x",
"jquery": "1.9.x",
"lodash": "2.3.x",

  • "backbone": "1.1.x",
  • "backbone": "git://github.com/jashkenas/backbone#3994c1cb8592c7e30613e9f869fe60c1cdce6164",

? Is it unstable?


Reply to this email directly or view it on GitHub
https://github.com/chaplinjs/chaplin/pull/780/files#r30563667.

Fix failing tests without jQuery
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants