Skip to content

Commit f455201

Browse files
committed
bump and build v1.7.4
1 parent a20d296 commit f455201

13 files changed

+266
-109
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"./lib/backbone.marionette.js",
77
"./lib/core/amd/backbone.marionette.js"
88
],
9-
"version": "1.7.3",
9+
"version": "1.7.4",
1010
"keywords": [
1111
"backbone",
1212
"framework",

changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
### v1.7.4 [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v1.7.3...v1.7.4)
2+
3+
* General
4+
* Update bower dependencies to take advantage of the fact that marionette repos follow semver.
5+
6+
* Fixes
7+
* Behaviors events no longer collide with each other.
8+
* Revert `stopListening` call on `stop` for modules. While this was a "fix", the docs were quite vague leading to breaking changes for many people.
9+
* `startWithParent` is now respected when using a `moduleClass` property.
10+
111
### v1.7.3 [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v1.7.2...v1.7.3)
212

313
* Behaviors

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "backbone.marionette",
33
"description": "Make your Backbone.js apps dance!",
4-
"version": "1.7.3",
4+
"version": "1.7.4",
55
"repo": "marionettejs/backbone.marionette",
66
"main": "lib/core/amd/backbone.marionette.js",
77
"keywords": [

lib/backbone.marionette.js

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MarionetteJS (Backbone.Marionette)
22
// ----------------------------------
3-
// v1.7.3
3+
// v1.7.4
44
//
55
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
66
// Distributed under MIT license
@@ -2288,7 +2288,8 @@ Marionette.Behaviors = (function(Marionette, _) {
22882288
_.each(_.keys(behaviorEvents), function(key) {
22892289
// append white-space at the end of each key to prevent behavior key collisions
22902290
// this is relying on the fact backbone events considers "click .foo" the same "click .foo "
2291-
var whitespace = (new Array(i+1)).join(" ");
2291+
// starts with an array of two so the first behavior has one space
2292+
var whitespace = (new Array(i+2)).join(" ");
22922293
var eventKey = key + whitespace;
22932294
var handler = _.isFunction(behaviorEvents[key]) ? behaviorEvents[key] : b[behaviorEvents[key]];
22942295

@@ -2612,8 +2613,6 @@ _.extend(Marionette.Module.prototype, Backbone.Events, {
26122613
this._initializerCallbacks.reset();
26132614
this._finalizerCallbacks.reset();
26142615

2615-
this.stopListening();
2616-
26172616
Marionette.triggerMethod.call(this, "stop");
26182617
},
26192618

@@ -2713,49 +2712,62 @@ _.extend(Marionette.Module, {
27132712
return moduleDefinition.moduleClass || ModuleClass;
27142713
},
27152714

2715+
// Add the module definition and add a startWithParent initializer function.
2716+
// This is complicated because module definitions are heavily overloaded
2717+
// and support an anonymous function, module class, or options object
27162718
_addModuleDefinition: function(parentModule, module, def, args){
2717-
var fn;
2718-
var startWithParent;
2719+
var fn = this._getDefine(def);
2720+
var startWithParent = this._getStartWithParent(def, module);
2721+
2722+
if (fn){
2723+
module.addDefinition(fn, args);
2724+
}
27192725

2720-
if (_.isFunction(def) && !(def.prototype instanceof Marionette.Module)){
2721-
// if a function is supplied for the module definition
2722-
fn = def;
2723-
startWithParent = true;
2726+
this._addStartWithParent(parentModule, module, startWithParent);
2727+
},
27242728

2725-
} else if (_.isObject(def)){
2726-
// if an object is supplied
2727-
fn = def.define;
2728-
startWithParent = !_.isUndefined(def.startWithParent) ? def.startWithParent : true;
2729+
_getStartWithParent: function(def, module) {
2730+
var swp;
27292731

2730-
} else {
2731-
// if nothing is supplied
2732-
startWithParent = true;
2732+
if (_.isFunction(def) && (def.prototype instanceof Marionette.Module)) {
2733+
swp = module.constructor.prototype.startWithParent;
2734+
return _.isUndefined(swp) ? true : swp;
27332735
}
27342736

2735-
// add module definition if needed
2736-
if (fn){
2737-
module.addDefinition(fn, args);
2737+
if (_.isObject(def)){
2738+
swp = def.startWithParent;
2739+
return _.isUndefined(swp) ? true : swp;
27382740
}
27392741

2740-
// `and` the two together, ensuring a single `false` will prevent it
2741-
// from starting with the parent
2742-
module.startWithParent = module.startWithParent && startWithParent;
2742+
return true;
2743+
},
27432744

2744-
// setup auto-start if needed
2745-
if (module.startWithParent && !module.startWithParentIsConfigured){
2745+
_getDefine: function(def) {
2746+
if (_.isFunction(def) && !(def.prototype instanceof Marionette.Module)) {
2747+
return def;
2748+
}
27462749

2747-
// only configure this once
2748-
module.startWithParentIsConfigured = true;
2750+
if (_.isObject(def)){
2751+
return def.define;
2752+
}
27492753

2750-
// add the module initializer config
2751-
parentModule.addInitializer(function(options){
2752-
if (module.startWithParent){
2753-
module.start(options);
2754-
}
2755-
});
2754+
return null;
2755+
},
27562756

2757+
_addStartWithParent: function(parentModule, module, startWithParent) {
2758+
module.startWithParent = module.startWithParent && startWithParent;
2759+
2760+
if (!module.startWithParent || !!module.startWithParentIsConfigured){
2761+
return;
27572762
}
27582763

2764+
module.startWithParentIsConfigured = true;
2765+
2766+
parentModule.addInitializer(function(options){
2767+
if (module.startWithParent){
2768+
module.start(options);
2769+
}
2770+
});
27592771
}
27602772
});
27612773

lib/backbone.marionette.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/backbone.marionette.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/amd/backbone.marionette.js

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MarionetteJS (Backbone.Marionette)
22
// ----------------------------------
3-
// v1.7.3
3+
// v1.7.4
44
//
55
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
66
// Distributed under MIT license
@@ -1878,7 +1878,8 @@ Marionette.Behaviors = (function(Marionette, _) {
18781878
_.each(_.keys(behaviorEvents), function(key) {
18791879
// append white-space at the end of each key to prevent behavior key collisions
18801880
// this is relying on the fact backbone events considers "click .foo" the same "click .foo "
1881-
var whitespace = (new Array(i+1)).join(" ");
1881+
// starts with an array of two so the first behavior has one space
1882+
var whitespace = (new Array(i+2)).join(" ");
18821883
var eventKey = key + whitespace;
18831884
var handler = _.isFunction(behaviorEvents[key]) ? behaviorEvents[key] : b[behaviorEvents[key]];
18841885

@@ -2202,8 +2203,6 @@ _.extend(Marionette.Module.prototype, Backbone.Events, {
22022203
this._initializerCallbacks.reset();
22032204
this._finalizerCallbacks.reset();
22042205

2205-
this.stopListening();
2206-
22072206
Marionette.triggerMethod.call(this, "stop");
22082207
},
22092208

@@ -2303,49 +2302,62 @@ _.extend(Marionette.Module, {
23032302
return moduleDefinition.moduleClass || ModuleClass;
23042303
},
23052304

2305+
// Add the module definition and add a startWithParent initializer function.
2306+
// This is complicated because module definitions are heavily overloaded
2307+
// and support an anonymous function, module class, or options object
23062308
_addModuleDefinition: function(parentModule, module, def, args){
2307-
var fn;
2308-
var startWithParent;
2309+
var fn = this._getDefine(def);
2310+
var startWithParent = this._getStartWithParent(def, module);
2311+
2312+
if (fn){
2313+
module.addDefinition(fn, args);
2314+
}
23092315

2310-
if (_.isFunction(def) && !(def.prototype instanceof Marionette.Module)){
2311-
// if a function is supplied for the module definition
2312-
fn = def;
2313-
startWithParent = true;
2316+
this._addStartWithParent(parentModule, module, startWithParent);
2317+
},
23142318

2315-
} else if (_.isObject(def)){
2316-
// if an object is supplied
2317-
fn = def.define;
2318-
startWithParent = !_.isUndefined(def.startWithParent) ? def.startWithParent : true;
2319+
_getStartWithParent: function(def, module) {
2320+
var swp;
23192321

2320-
} else {
2321-
// if nothing is supplied
2322-
startWithParent = true;
2322+
if (_.isFunction(def) && (def.prototype instanceof Marionette.Module)) {
2323+
swp = module.constructor.prototype.startWithParent;
2324+
return _.isUndefined(swp) ? true : swp;
23232325
}
23242326

2325-
// add module definition if needed
2326-
if (fn){
2327-
module.addDefinition(fn, args);
2327+
if (_.isObject(def)){
2328+
swp = def.startWithParent;
2329+
return _.isUndefined(swp) ? true : swp;
23282330
}
23292331

2330-
// `and` the two together, ensuring a single `false` will prevent it
2331-
// from starting with the parent
2332-
module.startWithParent = module.startWithParent && startWithParent;
2332+
return true;
2333+
},
23332334

2334-
// setup auto-start if needed
2335-
if (module.startWithParent && !module.startWithParentIsConfigured){
2335+
_getDefine: function(def) {
2336+
if (_.isFunction(def) && !(def.prototype instanceof Marionette.Module)) {
2337+
return def;
2338+
}
23362339

2337-
// only configure this once
2338-
module.startWithParentIsConfigured = true;
2340+
if (_.isObject(def)){
2341+
return def.define;
2342+
}
23392343

2340-
// add the module initializer config
2341-
parentModule.addInitializer(function(options){
2342-
if (module.startWithParent){
2343-
module.start(options);
2344-
}
2345-
});
2344+
return null;
2345+
},
23462346

2347+
_addStartWithParent: function(parentModule, module, startWithParent) {
2348+
module.startWithParent = module.startWithParent && startWithParent;
2349+
2350+
if (!module.startWithParent || !!module.startWithParentIsConfigured){
2351+
return;
23472352
}
23482353

2354+
module.startWithParentIsConfigured = true;
2355+
2356+
parentModule.addInitializer(function(options){
2357+
if (module.startWithParent){
2358+
module.start(options);
2359+
}
2360+
});
23492361
}
23502362
});
23512363

lib/core/amd/backbone.marionette.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/backbone.marionette.js

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,8 @@ Marionette.Behaviors = (function(Marionette, _) {
18421842
_.each(_.keys(behaviorEvents), function(key) {
18431843
// append white-space at the end of each key to prevent behavior key collisions
18441844
// this is relying on the fact backbone events considers "click .foo" the same "click .foo "
1845-
var whitespace = (new Array(i+1)).join(" ");
1845+
// starts with an array of two so the first behavior has one space
1846+
var whitespace = (new Array(i+2)).join(" ");
18461847
var eventKey = key + whitespace;
18471848
var handler = _.isFunction(behaviorEvents[key]) ? behaviorEvents[key] : b[behaviorEvents[key]];
18481849

@@ -2166,8 +2167,6 @@ _.extend(Marionette.Module.prototype, Backbone.Events, {
21662167
this._initializerCallbacks.reset();
21672168
this._finalizerCallbacks.reset();
21682169

2169-
this.stopListening();
2170-
21712170
Marionette.triggerMethod.call(this, "stop");
21722171
},
21732172

@@ -2267,49 +2266,62 @@ _.extend(Marionette.Module, {
22672266
return moduleDefinition.moduleClass || ModuleClass;
22682267
},
22692268

2269+
// Add the module definition and add a startWithParent initializer function.
2270+
// This is complicated because module definitions are heavily overloaded
2271+
// and support an anonymous function, module class, or options object
22702272
_addModuleDefinition: function(parentModule, module, def, args){
2271-
var fn;
2272-
var startWithParent;
2273+
var fn = this._getDefine(def);
2274+
var startWithParent = this._getStartWithParent(def, module);
2275+
2276+
if (fn){
2277+
module.addDefinition(fn, args);
2278+
}
22732279

2274-
if (_.isFunction(def) && !(def.prototype instanceof Marionette.Module)){
2275-
// if a function is supplied for the module definition
2276-
fn = def;
2277-
startWithParent = true;
2280+
this._addStartWithParent(parentModule, module, startWithParent);
2281+
},
22782282

2279-
} else if (_.isObject(def)){
2280-
// if an object is supplied
2281-
fn = def.define;
2282-
startWithParent = !_.isUndefined(def.startWithParent) ? def.startWithParent : true;
2283+
_getStartWithParent: function(def, module) {
2284+
var swp;
22832285

2284-
} else {
2285-
// if nothing is supplied
2286-
startWithParent = true;
2286+
if (_.isFunction(def) && (def.prototype instanceof Marionette.Module)) {
2287+
swp = module.constructor.prototype.startWithParent;
2288+
return _.isUndefined(swp) ? true : swp;
22872289
}
22882290

2289-
// add module definition if needed
2290-
if (fn){
2291-
module.addDefinition(fn, args);
2291+
if (_.isObject(def)){
2292+
swp = def.startWithParent;
2293+
return _.isUndefined(swp) ? true : swp;
22922294
}
22932295

2294-
// `and` the two together, ensuring a single `false` will prevent it
2295-
// from starting with the parent
2296-
module.startWithParent = module.startWithParent && startWithParent;
2296+
return true;
2297+
},
22972298

2298-
// setup auto-start if needed
2299-
if (module.startWithParent && !module.startWithParentIsConfigured){
2299+
_getDefine: function(def) {
2300+
if (_.isFunction(def) && !(def.prototype instanceof Marionette.Module)) {
2301+
return def;
2302+
}
23002303

2301-
// only configure this once
2302-
module.startWithParentIsConfigured = true;
2304+
if (_.isObject(def)){
2305+
return def.define;
2306+
}
23032307

2304-
// add the module initializer config
2305-
parentModule.addInitializer(function(options){
2306-
if (module.startWithParent){
2307-
module.start(options);
2308-
}
2309-
});
2308+
return null;
2309+
},
23102310

2311+
_addStartWithParent: function(parentModule, module, startWithParent) {
2312+
module.startWithParent = module.startWithParent && startWithParent;
2313+
2314+
if (!module.startWithParent || !!module.startWithParentIsConfigured){
2315+
return;
23112316
}
23122317

2318+
module.startWithParentIsConfigured = true;
2319+
2320+
parentModule.addInitializer(function(options){
2321+
if (module.startWithParent){
2322+
module.start(options);
2323+
}
2324+
});
23132325
}
23142326
});
23152327

lib/core/backbone.marionette.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/backbone.marionette.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "backbone.marionette",
33
"description": "Make your Backbone.js apps dance!",
4-
"version": "1.7.3",
4+
"version": "1.7.4",
55
"homepage": "https://github.com/marionettejs/backbone.marionette",
66
"main": "lib/core/amd/backbone.marionette.js",
77
"keywords": [

0 commit comments

Comments
 (0)