emberjs / ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
https://emberjs.com
MIT License
22.47k stars 4.21k forks source link

{{action}} helper broken in master #1302

Closed fpauser closed 12 years ago

fpauser commented 12 years ago

After updating emberjs in my rails-app from v1.0.pre-7-g37780cf to current ember-js the {{action}} helper stopped working - maybe a context problem?

sly7-7 commented 12 years ago

Could you post a jsfiddle to illustrate it ?

fpauser commented 12 years ago

Works: http://jsfiddle.net/PZkQm/ (ember-1.0-pre)

Does not work: http://jsfiddle.net/dc9Sb/ (ember-current)

PS: click the "X" to trigger the action

sly7-7 commented 12 years ago

I think I've finally found what happened. Since this commit: https://github.com/emberjs/ember.js/commit/35fb8026e6f5abbeb936cd98f17e749f257beef1 the version of jQuery should be 1.8. I you update your fiddle, it works.

@wagenet, Peter, does that mean that ember is no more compatible with jQuery 1.7.2 ?

wagenet commented 12 years ago

If you look carefully, you'll see that that commit still runs tests with 1.7.2 as well. 1.8 is just the default now. https://github.com/emberjs/ember.js/commit/35fb8026e6f5abbeb936cd98f17e749f257beef1#L0R140

fpauser commented 12 years ago

@sly7-7 No, upgrading to jquery-1.8 does not work: http://jsfiddle.net/CgRxW/

sly7-7 commented 12 years ago

I don't know what I've done, I apologize... I played this fiddle on multiple ember builds, and it seemed to work. I will try to continue to investigate...

sly7-7 commented 12 years ago

Well, by doing a very smart search (:D), it seems this commit https://github.com/emberjs/ember.js/commit/ba3e74e02d160fa870181a851c9e897fc66e4b6c breaks some things.

see: http://jsfiddle.net/Sly7/Nusjm/, doesn't work and http://jsfiddle.net/Sly7/tkrVV/ (only one commit behind) works.

Going a little further, it seems that since this "problematic" commit, calling App.initialize() makes the job working. I was going to put a comment to this commit, but reading @tomhuda commit's comment: - If you don't call initialize, you're gonna have a bad time.

I think it's explicit...

see http://jsfiddle.net/Sly7/kV2rL/

wagenet commented 12 years ago

Looks like this is probably a documentation issue.

trek commented 12 years ago

So, what is the actual issue? Does {{action}} not work on un-initialized apps?

sly7-7 commented 12 years ago

Yep, you can see it on the different fiddle here. But I think that more generally, un-initialized apps don't work at all. @wycats, @tomdale, am I right ?

fpauser commented 12 years ago

Closing this issue - solution is to call "initialize()".

tomdale commented 12 years ago

@sly7-7 That's correct; you must call initialize() before the application sets itself up now. This is required because there are instances where applications become ready asynchronously. The case we were running into was that we needed to ready our IndexedDB before we started routing.