Skip to content

v2.3.0-pre

Pre-release
Pre-release
Compare
Choose a tag to compare
@samccone samccone released this 10 Dec 23:42
· 1109 commits to master since this release

npm i [email protected]
bower i backbone.marionette#v2.3.0-pre

Marionette v2.3.0 in Overview:

This release of Marionette contains a significant amount of code optimizations and refactors. These changes will not be visible to you as end user however as they improve the underlying base of Marionette and speed up your app to improve consistency across the base classes. Such speed ups are most visible in the great work @megawac has been doing in both serializeData and triggerMethod

As always you can come chat with us in the main chatroom at https://gitter.im/marionettejs/backbone.marionette/

Work has been continuing on improving the documentation of Marionette, via an external custom JSDOC tool that @ChetHarrison has been spear heading via https://github.com/ChetHarrison/jsdoccer

If you have not already checked out Marionette Inspector, it is a great tool that @jasonLaster has been working on to make debugging and working with marionette much easier. https://github.com/MarionetteLabs/marionette.inspector

Features
  • Marionette.isNodeAttached
    • Determines whether the passed-in node is a child of the document or not.
  • View "attach" / onAttach event
  • Triggered anytime that showing the view in a Region causes it to be attached to the document. Like other Marionette events, it also executes a callback method, onAttach, if you've specified one.
  • View "before:attach" / onBeforeAttach
    • This is just like the attach event described above, but it's triggered right before the view is attached to the document.
  • AppRouter Enhancements
  • triggerMethod, bindEntityEvents, and unbindEntityEvents are now available on AppRouter
  • Marionette.Application is now a subclass of Marionette.Object
  • Marionette.Behavior is now a subclass of Marionette.Object
  • Marionette.Region is now a subclass of Marionette.Object
  • CompositeView’s getChildViewContainer now receives childView as a second argument.
  • Region Triggers now pass the view, region instance, and trigger options to all handler methods
  • CollectionView emptyViewOption method now receives the model, and index as options.
  • Allow non-DOM-backed regions with allowMissingEl
  • allowMissingEl option is respected by _ensureElement
  • _ensureElement returns boolean, indicating whether or not element is available
  • Region#show early-terminates on missing element
  • Regions now ensure the view being shown is valid
    • Allowing you to handle the error of a region.show without the region killing the currentView and breaking without recourse.
  • Appending isDestroyed to a Backbone.View on region empty now adds the same safety for not re-showing a removed backbone view.
  • Marionette is now aliased as Mn on the window.
  • Collection/Composite Views now support passing in 'sort' as both a class property and as an option.
  • RegionManager will now auto instantiate regions that are attached to the regionManager instance.
new Marionette.RegionManager({
  regions: {
    "aRegion": "#bar"
  }
});
Fixes
  • Region now uses $.el.html(‘’) instead of .innerHTML to clear contents.
    • We can not use .innerHTML due to the fact that IE will not let us clear the html of tables and selects. We also do not want to use the more declarative empty method that jquery exposes since .empty loops over all of the children DOM nodes and unsets the listeners on each node. While this seems like a desirable thing, it comes at quite a high perf cost. For that reason we are simply clearing the html contents of the node.
  • Destroying an old view kept alive by {preventDestroy: true} no longer empties it’s former region.
  • Now the destroy listener from previous view is removed on region show
  • AppRouter this.options now assigned prior to initialize being called.
Deprecation Warnings
  • Marionette.Application.addInitializer
  • Marionette.Application Channel
  • Marionette.Application Regions
  • Marionette.Callbacks
  • Marionette.Deferred
  • Marionette.Module.addInitializer
  • Marionette.Module.addFinalizer