snikch/jquery.dirtyforms — Issue #11: Refiring 'click' only works for elements that have having 'href' themselves
Author: dannyadair
Created: 2011-10-19 02:07:25+00:00
State: open

I'm using http://www.wizzud.com/jqDock/ which handles 'click' on an element that's inside an anchor. Therefore the triggering element does not have an "href" itself.

To handle such a scenario,
https://github.com/snikch/jquery.dirtyforms/blob/master/jquery.dirtyforms.js#L295
should read "get the closest element that has an 'href' attribute":

```javascript
var anchor = $(e.target).closest('[href]');
dirtylog('Sending location to ' + anchor.attr('href'));
location.href = anchor.attr('href');
```
(I'm just defining anchor so it doesn't need to get determined twice)

http://api.jquery.com/closest/ says
"The .closest() method begins its search with the element itself before progressing up the DOM tree, and stops when item A matches the selector."
so that won't affect the behaviour for (the expected) a tags.