diff --git a/Backbone.ModelBinder.js b/Backbone.ModelBinder.js index 8865627..898ce16 100644 --- a/Backbone.ModelBinder.js +++ b/Backbone.ModelBinder.js @@ -1,4 +1,4 @@ -// Backbone.ModelBinder v1.0.3 +// Backbone.ModelBinder v1.0.4 // (c) 2013 Bart Wood // Distributed Under MIT License @@ -26,7 +26,7 @@ }; // Current version of the library. - Backbone.ModelBinder.VERSION = '1.0.3'; + Backbone.ModelBinder.VERSION = '1.0.4'; Backbone.ModelBinder.Constants = {}; Backbone.ModelBinder.Constants.ModelToView = 'ModelToView'; Backbone.ModelBinder.Constants.ViewToModel = 'ViewToModel'; diff --git a/Backbone.ModelBinder.min.js b/Backbone.ModelBinder.min.js index 77bc968..d6936ad 100644 --- a/Backbone.ModelBinder.min.js +++ b/Backbone.ModelBinder.min.js @@ -1,4 +1,4 @@ -// Backbone.ModelBinder v1.0.3 +// Backbone.ModelBinder v1.0.4 // (c) 2013 Bart Wood // Distributed Under MIT License (function(e){if(typeof define==="function"&&define.amd){define(["underscore","jquery","backbone"],e)}else{e(_,$,Backbone)}})(function(e,t,n){if(!n){throw"Please include Backbone.js before Backbone.ModelBinder.js"}n.ModelBinder=function(){e.bindAll.apply(e,[this].concat(e.functions(this)))};n.ModelBinder.SetOptions=function(e){n.ModelBinder.options=e};n.ModelBinder.VERSION="1.0.3";n.ModelBinder.Constants={};n.ModelBinder.Constants.ModelToView="ModelToView";n.ModelBinder.Constants.ViewToModel="ViewToModel";e.extend(n.ModelBinder.prototype,{bind:function(e,n,r,i){this.unbind();this._model=e;this._rootEl=n;this._setOptions(i);if(!this._model)this._throwException("model must be specified");if(!this._rootEl)this._throwException("rootEl must be specified");if(r){this._attributeBindings=t.extend(true,{},r);this._initializeAttributeBindings();this._initializeElBindings()}else{this._initializeDefaultBindings()}this._bindModelToView();this._bindViewToModel()},bindCustomTriggers:function(e,t,n,r,i){this._triggers=n;this.bind(e,t,r,i)},unbind:function(){this._unbindModelToView();this._unbindViewToModel();if(this._attributeBindings){delete this._attributeBindings;this._attributeBindings=undefined}},_setOptions:function(t){this._options=e.extend({boundAttribute:"name"},n.ModelBinder.options,t);if(!this._options["modelSetOptions"]){this._options["modelSetOptions"]={}}this._options["modelSetOptions"].changeSource="ModelBinder";if(!this._options["changeTriggers"]){this._options["changeTriggers"]={"":"change","[contenteditable]":"blur"}}if(!this._options["initialCopyDirection"]){this._options["initialCopyDirection"]=n.ModelBinder.Constants.ModelToView}},_initializeAttributeBindings:function(){var t,n,r,i,s;for(t in this._attributeBindings){n=this._attributeBindings[t];if(e.isString(n)){r={elementBindings:[{selector:n}]}}else if(e.isArray(n)){r={elementBindings:n}}else if(e.isObject(n)){r={elementBindings:[n]}}else{this._throwException("Unsupported type passed to Model Binder "+r)}for(i=0;i0;for(n=0;n ## Release Notes / Versions -### v 1.0.3 August 19, 2013 +### v 1.0.4 August 19, 2013 * Fixed the _.bindAll function calls to specify the function names being bound to. * Added the ability to add a global converter via Backbone.ModelBinder.SetOptions({converter: xxx});