Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time

See upgrading guide if you're using old chaplin version and want to upgrade.

Chaplin 1.1.0 (29 October 2015)

  • Makes Chaplin work correctly with latest Lodash.
  • Fixes invalid CollectionView behavior in IE11.
  • Added ms-appx to the Layout's list of supported protocols by default.

Chaplin 1.0.1 (22 June 2014)

  • A few bugfixes.

Chaplin 1.0.0 (23 January 2014)

  • route.previous is now undefined instead of an empty object if there is no previous object.

Chaplin 0.13.0 (18 January 2014)

  • Renamed Controller#compose to Controller#reuse
  • Added trailing option for Router which will:
    • When false (default), strip accident route slashes: /users/ => /users
    • When true, append all route slashes: /users => /users/
    • When null, do nothing (like before): /users != /users/
  • Normalize URI handling with trailing slashes
  • Added support for optional Route params, like this: /users/(:user)
  • route.previous param of controller actions is now saved only once.
  • Fixed bug when last char was removed from query string

Chaplin 0.12.0 (10 December 2013)

  • Added support for Exoskeleton 0.6. Previous versions are now incompatible.
  • Removed Delayer. Use separate Delayer package if you want to use it.
  • Chaplin.helpers were merged with Chaplin.utils. Use utils now for reverse and redirectTo.
  • CollectionView#filter now ignores arguments if they are not functions. Useful if you want to call it on some DOM event from events hash.
  • CollectionView#listSelector can now also be a function.
  • Dispatcher now loads common.js code on next event loop tick (setTimeout load, 0) instead of previous fully synchronous behaviour to match AMD.

Chaplin 0.11.3 (29 October 2013)

  • Fixed view regions.
  • Fixed filtering of collection view elements.
  • Backbone.History is now used as Chaplin.History if it's patched (with query string support).

Chaplin 0.11.2 (24 October 2013)

  • Added support for Exoskeleton — faster and leaner Backbone.
  • Thanks to that, you can now use Chaplin without underscore or jQuery dependencies at all! Just Exoskeleton and Chaplin. Make sure to set window._ to Backbone.utils in no-deps environment.

Chaplin 0.11.1 (2 October 2013)

  • Dispatcher#dispatch now checks if options.query hash was changed.
  • Route#reverse now won't add a ? symbol at the end of a returned url if you pass an empty object as a query parameter (second one)
  • utils.queryParams.stringify will now ignore undefined and null values

Chaplin 0.11.0 (21 September 2013)

  • Chaplin internals now use Request / Response pattern instead of bang !events. New system also allows to return values. The syntax is so: mediator.setHandler(name, function), mediator.execute(name, args...). Removed events:
    • !router:route, !router:routeByName (use helpers.redirectTo)
    • !router:changeURL
    • !composer:compose, !composer:retrieve
    • !region:register, !region:unregister
    • !adjustTitle (use mediator.execute('adjustTitle', name) or Controller#adjustTitle). An adjustTitle event would be triggered after title is set.
  • Improved Chaplin.Controller:
    • Controller#compose method now:
      • by default, returns the composition itself
      • if composition body returned a promise, it returns a promise too
    • Removed Controller#redirectToRoute. Use Controller#redirectTo.
    • redirectTo now takes route name by default. If you want to pass URL, use it as redirectTo({url: 'URL'}).
  • Improved Chaplin.View:
    • Added noWrap option that allows to disable Backbone top-level element bound to view class.
    • Added optionNames property that contains a list of options that will be picked from an object passed to View, when initialising it. Property allows to simply extend it in your child classes: optionNames: ParentView.prototype.optionNames.concat(['template'])
    • Views now appended to DOM only if they were not there.
  • Improved Chaplin.Layout:
    • When push state is disabled, internal links are handled as if they had # (gh-664).
  • Improved Chaplin.helpers:
    • Added helpers.redirectTo which allows to redirect to other route or url.
  • Improved Chaplin.utils:
    • Added utils.queryParams.{stringify,parse}.
    • utils.getPrototypeChain now returns prototypes from oldest to newest, to match utils.getAllPropertyVersions.
  • Improved Chaplin.Router:
    • Route#reverse (as well as Router#reverse) are now able to add query parameters to the reversed URL, no matter if they are already stringified or not when passed into the reverse (as a third parameter).
    • Route#matches improved not to return true when the only controller or action parameter passed.
    • Fixed getCurrentQuery error when pushState is disabled (gh-671).
    • Query params are now not copied to next routes (gh-677).
  • Improved Chaplin.Application:
    • Renamed startRouting to start, the following method also does freezing of app object.
  • Temporarily added Chaplin.History that overrides Backbone.History. It won't not ignore query string history as compared to Backbone (gh-577).

Special thanks to Andrew Yankovsky.

Chaplin 0.10.0 (30 June 2013)

Chaplin now provides universal build for Common.js and AMD.

  • Improved Chaplin.Application:
    • Application is now initialized by default with new Application constructor method instead of Application#initialize.
    • Added default Application#initialize functionality.
  • Improved Chaplin.Router:
    • Early error is now thrown for !router:route, !router:routeByName and Chaplin.helpers.reverse methods when nothing is matched.
    • Removed callback argument from !router:route and !router:routeByName.
  • Improved Chaplin.View:
    • Breaking: regions syntax has changed to more logical. Before: regions: {'.selector': 'region'}. Now: regions: {'region': '.selector'}. We’ve made a small utility that automatically updates your code to new syntax: replace.js. Also, updated registerRegion method signature to similar.
    • regions option can now be passed to constructor.
    • insertView now returns inserted view.
  • Fix controller disposal after redirect.

Chaplin 0.9.0 (4 May 2013)

  • Added full lodash compatibility.
  • Removed deferred mix-in (initDeferred) support from models, collections and views.
  • Improved Chaplin.Controller and Chaplin.Dispatcher:
    • Made Controller#beforeAction a function. The old object form is not supported anymore. You need to use super like in any other method, beforeActions won’t be merged without it. Asyncronous beforeActions with promises are still supported.
    • Controllers are now disposed automatically after redirection or asynchronous before actions.
  • Improved Chaplin.Router:
    • Fixed bug with preserving query string in URL.
    • Removed underscorizing of loaded by default controller names. deleted_users#show won’t longer be rewritten to deletedUsers#show. The controller name in the route is directly used as module name.
  • Improved Chaplin.View:
    • Added keepElement property (false by default). When truthy, the view’s DOM element won’t be removed after disposal.
    • View#dispose now calls Backbone’s View#remove method.
    • Subviews are now always an array.
  • Improved Chaplin.CollectionView:
    • Added Backbone 1.0 Collection#set support.
  • Improved Chaplin.Layout:
    • Added inheritance from Chaplin.View.
    • Renamed some methods for compat with Chaplin.View:
      • _registeredRegions to globalRegions
      • registerRegion to registerGlobalRegion
      • registerRegion to registerGlobalRegions
      • unregisterRegion to unregisterGlobalRegion
      • unregisterRegions to unregisterGlobalRegions
    • Changed default Layout element from document to body.
    • Removed explicit view.$ / hide() for managed views.
    • Removed route property. Use settings.routeLinks instead.
  • Improved Chaplin.utils:
    • Removed underscorize.

Chaplin 0.8.1 (1 April 2013)

  • Improved Chaplin.Layout:
    • Added Layout#$ method, which is the same as View#$. This also fixes how regions behave in Layout.
  • Improved Chaplin.View:
    • The check is now done when listening to collection dispose event whether it really came from collection and not from its model.

Chaplin 0.8.0 (31 March 2013)

  • Added Chaplin.helpers component. It contains Chaplin-related functions. Chaplin.utils will contain generic functions.
    • helpers.reverse allows to get route URL by its name and params.
  • Improved Chaplin.Application:
    • Separated router initialisation and start of listening for routing. The first one as before resides in Application#initRouter. Application#startRouting. You need to launch both. This is breaking change and without it your app will not start routing.
  • Improved Chaplin.Controller:
    • All actions are now initialised with params, route, options instead of params, options. New route argument contains information about current route (controller, action, name, path) and about previous (route.previous) and options just contain options, passed to Backbone.history.navigate.
    • When using redirection in actions, controller will automatically dispose redirected controller.
  • Improved Chaplin.Router:
    • All routes now have default names in format of (controller + '#' + action).
    • Router#reverse will now prepend mount point.
    • Removed RegExp routes. Use constraints route param and strings instead.
  • Improved Chaplin.Layout:
    • Allowed registering regions.
    • Added Layout#isExternalLink that is used when clicking on any event and checks if current one is application-related.
  • Improved Chaplin.View:
    • If autoAttach option is false, view will not be added to container.
    • Empty-selector regions are now considered as bound to root view element.
  • Improved overall View and CollectionView performance for common cases.
  • Improved internal API:
    • Renamed matchRoute global event to router:match
    • Renamed startupController global event to dispatcher:dispatch
    • Changed signatures of many Dispatcher methods, they now pass route too.

Chaplin 0.7.0 (19 February 2013)

  • Added support of regions and regions composition with Chaplin.Composer. Composer grants the ability for views (and related data) to be persisted beyond one controller action.
  • Improved Chaplin.Controller:
    • Query string params are now passed to controllers (a feature removed from Backbone 0.9.9).
    • Controller actions will now receive an options hash as second argument, that contains path, previousControllerName and routing options. Previously, the second argument was just a previousControllerName string.
    • Fixed Controller#redirectTo signature (url, options).
    • Controller#dispose will now unbind all events bound by listenTo method.
  • Improved Chaplin.Dispatcher:
    • Stop waiting for a Promise returned by a before action when another route is dispatched or the same is dispatched again.
  • Improved Chaplin.Router:
    • The params and options objects are copied instead of changed to prevent conflicts. If you pass params and options along with the !router:route event, the controller action will receive a copy of them. Same for Dispatcher.
    • Fixed root option.
    • Fixed route reversals on empty patterns (for example, the top-level route).
  • Improved Chaplin.Collection:
    • Collection#dispose will now unbind all events bound by listenTo method.
    • Removed Collection#addAtomic as it was barely used.
  • Improved Chaplin.Model:
    • Model#serialize can be overridden on Backbone.Models. Chaplin will use it, if available, and Model#toJSON if not.
    • Model#dispose will now unbind all events bound by listenTo method.
    • Improved time complexity of Model#serialize from O(n) to amortized O(1).
  • Improved Chaplin.utils:
    • Added utils.getAllPropertyVersions that allows to gather all property versions from object’s prototypes.
    • Added utils.escapeRegExp that escapes all regular expression characters in string.
    • Removed utils.wrapMethod.
  • Improved Chaplin.View:
    • Added View#listen property that allows to declaratively listen to model / collection / mediator / view events. Just like Backbone’s View#events, which is only for DOM events.
    • Added new autoAttach option which determines whether view should be automatically attached to DOM after render.
    • Renamed View#afterRender to View#attach.
    • Removed View#afterInitialize.
    • Removed View#pass. Please use stickit instead for advanced model-view binding.
    • Switched to $el.toggle() instead of manual CSS display setting. Which means non-block elements will behave correctly.
    • Switched to Backbone.$ reference for DOM manipulation. This will automatically use jQuery, Zepto or Ender as DOM library.
    • Early error is now thrown when View#events is a function.
  • Improved Chaplin.CollectionView:
    • Renamed CollectionView#itemsResetted to CollectionView#itemsReset.
    • Renamed CollectionView#getView to CollectionView#initItemView.
    • Renamed CollectionView#showHideFallback to CollectionView#toggleFallback.
    • Renamed CollectionView#showHideLoadingIndicator to CollectionView#toggleLoadingIndicator.
    • Removed CollectionView#renderAndInsertItem.
    • Item views will now be called with autoRender: false, which prevents rendering them twice.
    • Item views will now emit addedToParent event instead of addedToDOM when they are appended to collection view.
    • Optimised performance by not calling jQuery / Zepto css / animate when animations are disabled.

Chaplin 0.6.0 (30 December 2012)

  • Updated required Backbone version to 0.9.9+.
  • Improved Chaplin.Collection:
    • Removed Collection#update since this function is now provided by Backbone itself (Collection#update in Backbone < 1.0, Collection#set in Backbone >= 1.0). The deep option is now called merge and it defaults to true.
  • Improved Chaplin.Controller:
    • Added Rails-like before action filters to Controllers.
    • Added Controller#redirectToRoute which works like Controller#redirectTo, but accepts route name instead of URL.
    • Added flexible Controller#adjustTitle method which sets window title.
    • Added Backbone.Events mix-in.
    • Removed Controller#title and Controller#historyURL.
    • Removed ability of redirecting to standalone controllers and action names in Controller#redirectTo.
  • Improved Chaplin.Router:
    • Added support for named routes.
    • Added new global !router:routeByName event, which allows to navigate to some route by its reverse name.
    • Added new global !router:reverse event, which allows to get URL of route by its name.
    • Added names option to Router#match, which allows to name route’s regular expression matches.
    • Removed global !startupController event.
  • Improved Chaplin.View:
    • Removed View#modelBind, View#modelUnbind and View#modelUnbindAll, since Backbone now implements superior Events.listenTo API.
    • Chaplin will now fix incorrect inheritance of view DOM events, bound in declarative manner (with events hash).
    • Moved View#wrapMethod to Chaplin.utils.wrapMethod.
    • View#dispose will now throw an error if View#initialize was called without super.
  • Improved Chaplin.CollectionView:
    • CollectionView#getTemplateData no longer returns items property, which increases performance.
  • Router options are now allowed to be passed in many places. New signatures are:
    • !router:route global event: path, options, callback (old sig is supported too)
    • Dispatcher#matchRoute: route, params, options
    • Controller#redirectTo: path or (controllerName, action, params, options)

Chaplin 0.5.0 (15 November 2012)

  • Improved and stabilized codebase.
  • Moved Chaplin.Subscriber to Chaplin.EventBroker, which now mixins publishEvent method to children.
  • Added Chaplin.Delayer, which sets unique and named timeouts and intervals so they can be cleared afterwards when disposing objects.
  • Added autoRender option to Chaplin.CollectionView, like Chaplin.View. Defaults to true, replaces old render option.
  • Added serialize method to collections
  • Removed CollectionView#viewsByCid and CollectionView#removeView in favor of consistent View#subview and View#removeSubview.
  • Removed CollectionView#initSyncMachine.
  • Removed trigger, on and off methods from Chaplin.mediator.
  • Allowed passing of multiple event types to View#delegate.
  • Made various aspects of Chaplin.Layout configurable.

Chaplin 0.4.0 (28 June 2012)

  • A lot of various global changes.
  • Added tests for all components.
  • Chaplin now can be used as a standalone library.

Chaplin 0.3.0 (23 March 2012)

  • Bug fix: In CollectionView, get the correct item position when rendering the item view. Fixes the rendering of sorted Collections. Before the fix, the item views might have been displayed in the wrong order. (@rendez)

Chaplin 0.2.0 (9 March 2012)

  • Fixed correct unsubscribing of global handlers when disposing a collection.
  • The codebase now uses consistent code style (@paulmillr).

Chaplin 0.1.0 (26 February 2012)

  • Initial release.