jashkenas/backbone — pull request #2857 by jrburke (2013-11-07 00:37:30+00:00)
Title: UMD wrapper for AMD, node and browser globals.

As requested by @jashkenas, he wanted to see what using a UMD pattern that added AMD registration would look like today. This is based on the version used in https://github.com/amdjs/backbone.

For the node registration, the dependency on just underscore is kept, and does not add jQuery, as this is how Backbone works in node today, and adding it would likely cause errors for existing node uses, since jQuery could not run in node given window/document use.

However, since the define() check is done first, if a developer wanted to use a jQuery-like that could work in node, it could be loaded by an AMD loader running in node, like [requirejs in node](http://requirejs.org/docs/node.html). This would be the likely use case today anyway, given existing AMD users that also do testing in node.

A test page is added to help prove out the changes work. I could remove it though if just the .js code change is wanted.