Leaflet/Leaflet — pull request #1778 by sheppard (2013-06-24 17:35:36+00:00)
Title: make AMD declaration anonymous

Thanks for adding AMD support to Leaflet! At some point, I'd like to follow up on the discussion in #1364 about using AMD for Leaflet's internal modules as well - but for now I have a simple request: can you change the module declaration to be anonymous? Explicitly declaring the module name leads to inflexibility, as I'll explain.

Per the [RequireJS docs](http://requirejs.org/docs/api.html#modulename), modules should generally be declared anonymously in order to support full portability between projects. For example, if I want to put leaflet in a `lib/` [subfolder in my JS directory](https://github.com/wq/wq.app/tree/master/js/lib), the resolved module name might be `lib/leaflet` (or `wq/lib/leaflet`), not `leaflet`. By defining the module anonymously, projects can integrate Leaflet wherever they wish without needing to define a RequireJS "paths" configuration pointing any dependencies on `leaflet` to their project's location of the file.

One of the only libraries that declares its AMD module explicitly is jquery, and this is largely for historical reasons - with the idea that this special case for jquery will be removed over time.

You'll notice that in this PR I've also removed the function that returns L - this is not needed since [define() can be used directly with simple objects](http://requirejs.org/docs/api.html#defsimple), in which case it will just return the object.