Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Fixes #1038 - Document changes to `view.$`. #1040
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
I ran into this; it was the main gotcha with upgrading Backbone 0.9. Our main view was using a template as view.el, and that worked fine in Backbone 0.5.3 (even if not intended). Eventually figured out what was going on by looking at the code, but a mention in the upgrade notes would have helped.
I don't think there is any question that the documentation above should change since it's patently false. As for the upgrade notes, there are certainly legitimate situations in which the previous behavior is very convenient. For instance:
var el = this.$(foo ? selector : htmlstring);
Obviously this could have been written differently but for what reason? The documentation spells out very clearly that it will work just fine.
The reason for the change was performance and a comparison shows that it can be 15-30% faster, and never slower. Is this enough to justify the change in API? I think it's a fairly easy thing to fix for a clear performance win. However, I don't have a strong opinion either way except that the change should be documented if the implementation is left as is.