BView

A Backbone.js View implementation

BView implements Backbone.js View, and nothing else.
One JavaScript class scopes to one (or many) HTML element.

Features

  1. 0 dependencies. jQuery or underscore.js.
  2. Modern Browsers (including Microsoft Edge).
  3. Auto view initializer. Just add data-view="YourViewClass".
  4. ~200 lines of ES6 JavaScript class.
  5. “Read and understand the source in an afternoon”, same as Backbone.js.

FAQ

Select elements within el

this.q(query_selector) and this.qAll(query_selector), similar to this.$el.find(query_selector).

Predefined selectors

Provides this.els similar to this.events to create predefined selector functions.

Debug

Set BView.debug to true to enable debug messages.

Setup BView in your project

Examples

Render Function

Multiple Instances

Passing arguments to View

View in a View

Paint