0

Has anyone had any issues with backbone v0.5.1 and Jquery v1.7.2? It seems the moment I upgrade jquery from v1.5.2 to v1.7.2 my application starts behaving weirdly. The model ids don't seem to be set right and only the defaults of -1 seem to get sent to the server.

I'm not sure what are the incompatibilities between the two versions but if someone has faced this could you please point them out so that I can fix them while upgrading?

Not sure if upgrading to v0.9.2 of backbone and v1.7.2 of jquery would automagically work - would it? We can't afford to have our application broken down as of now and am a bit apprehensive of just try and see. Any suggestions?

PhD
  • 11,202
  • 14
  • 64
  • 112
  • What errors are you getting? According to the docs, any jQuery > 1.4.2 will do – Pekka Jul 05 '12 at 19:29
  • @Pekka - As I said, I'm not getting errors but my functions are not behaving the way they are supposed to. For example, the IDs seem to be those at -1 and not that of the corresponding view/model. It seems there have been certain interface changes that is causing stuff to break – PhD Jul 05 '12 at 19:32
  • 1
    @PhD May be you could do a diff on Backbone.js version you have and latest to know what changed. Are you not comfortable upgrading Backbone to latest rather jQuery – Deeptechtons Jul 06 '12 at 04:19

1 Answers1

0

It seems the 'illusion of incompatibility' stemmed from jQuery's treatment of the data-* attribute tags from v1.5 to v1.7. The former ignored camelCased references e.g.

$('#myitem').data('myapp-someId') would be evaluated as myapp-someId but in 1.7 it converts camelCase into hyphenated separations i.e. it's evaluated as myapp-some-id which was causing everything to break and since I didn't expect functionality to break across the two version I misconstrued it to be incompatibilities between jQuery and Backbone.

After the data-* changes and upgrading jQuery and BB to the latest version everything works fine. Phew!

PhD
  • 11,202
  • 14
  • 64
  • 112