danzel/Leaflet.utfgrid — pull request #23 by ddelemeny (2013-12-25 22:03:06+00:00)
Title: Own refactoring, breaks compatibility

Hello there, I've been working with leaflet.utfgrid and stacked up a bit of refactoring, it's quite too big to merge as is, but you might still want to take a look.

Commented commit message follows :

The main item in my refactoring is the split of the two available loading behaviors in two classes, with XHR as sane default an JSONP being the overriding.
It extracts the JSONP/callbacks specific code from the base class, which is nice.

```
On XHR vs JSONP:
- L.UtfGrid defaults to XHR (sane default policy)
- Implement JSONP behavior in a child class : L.UtfGridP
- JSONP callbacks now have predictable names (set gridName option)
cb name pattern : L.UtfGridP._cb.{gridName}.tile_{z}_{x}_{y}(...)
```
A bit of refactoring on events handling, from Leaflet I borrow getEvents and add a few ones
```
Add "add", "remove" layer events.
Fire "mouseout" on map's mouseout.
```
On pointerCursor, attaching the behavior to the map's tilePane makes more sense to me.
Use the grid's events to tidy up the code and leaflet's css for consistency.

```
Re-implement pointerCursor behavior:
- bind to events from this (tidy up code)
- use leaflet-clickable css class on tilePane
```
```
Cherry-pick some code improvements from Mapbox and Leaflet.
```