Backbone: v1.3.2 backbone.js and backbone-min.js are not the same

Created on 22 Mar 2016  ·  7Comments  ·  Source: jashkenas/backbone

The minified version of 1.3.2 does not appear to include
https://github.com/jashkenas/backbone/commit/1db79ddd33f65e4ca93beb3174496cf148baebe5
while the unminfied version does.

Unminified

Events.once = function(name, callback, context) {
    // Map the event into a `{event: once}` object.
    var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));
    if (typeof name === 'string' && context == null) callback = void 0;
    return this.on(events, callback, context);
  };

Minified

l.once=function(t,e,r){
  var n=f(p,{},t,e,i.bind(this.off,this));
  return this.on(n,e,r)
}

@jridgewell @megawac

bug

All 7 comments

I have verified that the tests around this fails when you replace backbone.js with backbone-min.js in the test/index.html

Sigh. @megawac, can you create a v1.3.3 PR since I can't seem to get it right?

I just offered up https://github.com/jashkenas/backbone/pull/3994
I considered changing the index.html file to use the minified version, but wasn't sure if everyone would build before testing.

will there be any marionette compatible minified backbone v1.3.x soon? none existing yet afaik

1.3.2 works with Marionette 2.4.5 @elgubenis

Actually, Mn 2.4.5 composite views have an issue with minified backbone 1.3.2, that's how I found this problem to begin with.

CollectionViews bind via once
this.once('render', this._initialEvents);
https://github.com/marionettejs/backbone.marionette/blob/master/src/collection-view.js#L25

Composite views, which extend CollectionView
have _initialEvents that start with if (this.collection) {
https://github.com/marionettejs/backbone.marionette/blob/master/src/composite-view.js#L23
at that point, the this context is lost (Due to the need for fix https://github.com/jashkenas/backbone/commit/1db79ddd33f65e4ca93beb3174496cf148baebe5 ), so this.collection is falsey and therefor it does not start listening for the collection events appropriately

So be careful if you are using CollectionViews of CompositeViews which have a collection set on them prior to rendering.

Okay, yeah we have to republish a version with an updated minified file but the backbone.js file on master should work with 2.4.5. (we'll publish soon)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miguelpayet picture miguelpayet  ·  9Comments

inf3rno picture inf3rno  ·  17Comments

gfranko picture gfranko  ·  18Comments

PavelKoroteev picture PavelKoroteev  ·  10Comments

etler picture etler  ·  13Comments