shawnbot/hashable — pull request #5 by shawnbot (2014-04-29 00:41:46+00:00)
Title: Proposed fix for fragment identifier confusion

This PR proposes a fix for #4, by adding `hashable.hash()#valid()`, which provides a way to tell the hash change handler *not* to overwrite the hash if it doesn't match its format. The `hashable.validFragment()` function can be provided as the validation function to skip rewriting the hash if an element exists on the page with the fragment identifier listed in the hash. In other words, to create a custom hash handler with a custom format that also respects links to elements on the page, you would do this:

```html

...

```

In this case, if `location.hash === "#help"`, the change handler should trigger and `e.data` will be `null`; if `location.hash` matches the format `widgets/{widget}`, then `e.data.widget` should have a value; otherwise the default value will be used, the hash will be changed to `#widget/foo`, and the callback should get `e.data.widget === "foo"`.