sheet-router icon indicating copy to clipboard operation
sheet-router copied to clipboard

BUG: href.js doesn't trigger callback in IE

Open oderby opened this issue 8 years ago • 2 comments

Clicking on an anchor element in IE doesn't trigger the callback passed to href to be called. I believe this is because the logic for finding the anchor node containing the href doesn't work properly in IE, specifically line 24, which checks if the found anchor points to the same host as the current window, because the host property of anchor elements is not available on IE (nor Safari, for that matter).

oderby avatar Feb 25 '17 22:02 oderby

Uh oh, that's no good. Any suggestions on how to fix this?

On Sat, Feb 25, 2017, 23:01 Owen Derby [email protected] wrote:

Clicking on an anchor element in IE doesn't trigger the callback passed to href to be called. I believe this is because the logic for finding the anchor node containing the href doesn't work properly in IE, specifically line 24 https://github.com/yoshuawuyts/sheet-router/blob/master/href.js#L24, which checks if the found anchor points to the same host as the current window, because the host property of anchor elements is not available on IE https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/host (nor Safari, for that matter).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yoshuawuyts/sheet-router/issues/82, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWlenT__bIzT39FLOqFiQipD-WPtBpXks5rgKS2gaJpZM4MMJ0s .

yoshuawuyts avatar Feb 26 '17 15:02 yoshuawuyts

I'd be surprised if someone hasn't already written the logic to simulate/polyfill the host property - afterall, it should be deterministic given the href, right? I'm sure there are some corner cases, but you should be able to just pull in the bits you need, if you don't want the bloat of adding a whole library to do it.

oderby avatar Feb 26 '17 19:02 oderby