Skip to content

Commit

Permalink
Merge pull request #1452 from marionettejs/sjs/fix-behavior-ui-bug
Browse files Browse the repository at this point in the history
Fix behavior prototype event clobbering
  • Loading branch information
jamiebuilds committed Jun 6, 2014
2 parents 324141d + 47985f0 commit 64f2cc9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions spec/javascripts/behaviors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ describe("Behaviors", function(){
});
});

it('should not clobber the event prototype', function() {
expect(hold.test.prototype.events['click @ui.doge']).toEqual('onDogeClick');
});

it("should set the behavior UI element", function() {
v = new V;
v.render();
Expand Down
2 changes: 1 addition & 1 deletion src/marionette.behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Marionette.Behaviors = (function(Marionette, _) {

_.each(behaviors, function(b, i) {
var _events = {};
var behaviorEvents = _.result(b, 'events') || {};
var behaviorEvents = _.clone(_.result(b, 'events')) || {};
var behaviorUI = _.result(b, 'ui');

// Construct an internal UI hash first using
Expand Down

0 comments on commit 64f2cc9

Please sign in to comment.