Backbone Dependencies: Jquery

In notebook:
FrontEndMasters BackboneJS
Created at:
2016-02-05
Updated:
2016-02-05
Tags:
JavaScript jQuery libraries
Backbone has two big dependencies: jqeury and underscore

jQuery

Been around since 2006. Make the DOM easy to work with. Pass in CSS selectors then actions.
Goes through an example.
  1. Selector (CSS - style)
  2. attach Handler (click)
  3. $.post to a route
  4. display result in a callback on a DOM element
Chaining the API, anonymous callbacks, etc.

> "The DOM is a mess" - John Resig
Lots of inconsistencies in the DOM api. Especially older IE.

jQuery is a DOM Library

but it is not for organising and managing applications. Goes back to previous example: all these chainings encourage anti-patterns: not object-orient programming, coupling user interactions to data manipulation, everything very procedural, in-line (chaining) style

It can fall apart at large scale.