p3drosola/Backbone.VirtualCollection — pull request #16 by ronen (2014-01-07 14:14:40+00:00)
Title: Extend VirtualCollection from Backbone.Collection

Hello,

This PR makes it possible to use a VirtualCollection as if it were a Backbone.Collection in the case where some client code uses `instanceof Backbone.Collection` as part of its logic to check for collections.

(For example, http://dhruvaray.github.io/backbone-associations provides "fully qualified paths" such as `emp.get('works_for.controls[0].locations[0].zip')` -- for each component of the path it checks `instanceof Backbone.Collection` to know whether to expect an index)

The PR is pretty trivial in terms of code change, it just extends from `Backbone.Collection`, and moves the existing constructor code into a `constructor` field (so most of the changes are just indentation fallout). There's no attempt to either inherit nor suppress behavior provided by `Backbone.Collection`.

I've verified that the test suite passes, and I've tried it out in my own application, and all seems good. I'll admit though that I haven't thought through whether there are any deep or subtle issues that'd arise from this.