Setup is where most of controller's magic happens. It does the following:
Sets this.element
The first parameter passed to new Controller(el, options) is expected to be
an element. This gets converted to a jQuery wrapped element and set as
this.element.
Adds the controller's name to the element's className.
Controller adds it's plugin name to the element's className for easier
debugging. For example, if your Controller is named "Foo.Bar", it adds
"foo_bar" to the className.
Saves the controller in $.data
A reference to the controller instance is saved in $.data. You can find
instances of "Foo.Bar" like:
Setup is where most of controller's magic happens. It does the following:
Sets this.element
The first parameter passed to new Controller(el, options) is expected to be an element. This gets converted to a jQuery wrapped element and set as this.element.
Adds the controller's name to the element's className.
Controller adds it's plugin name to the element's className for easier debugging. For example, if your Controller is named "Foo.Bar", it adds "foo_bar" to the className.
Saves the controller in $.data
A reference to the controller instance is saved in $.data. You can find instances of "Foo.Bar" like:
Binds event handlers
Setup does the event binding described in Listening To Events.
API