Make mouseover/mouseout work with anchors that nest
This commit is contained in:
parent
e459fe92b0
commit
b7a37e2a25
|
@ -1,13 +1,15 @@
|
|||
// Add the mouse listeners for the above functions
|
||||
function linkHover() {
|
||||
window.onmouseover = function(event) {
|
||||
if (event.target.matches('a')) {
|
||||
window.webkit.messageHandlers.mouseDidEnter.postMessage(event.target.href);
|
||||
var closestAnchor = event.target.closest('a')
|
||||
if (closestAnchor) {
|
||||
window.webkit.messageHandlers.mouseDidEnter.postMessage(closestAnchor.href);
|
||||
}
|
||||
}
|
||||
window.onmouseout = function(event) {
|
||||
if (event.target.matches('a')) {
|
||||
window.webkit.messageHandlers.mouseDidExit.postMessage(event.target.href);
|
||||
var closestAnchor = event.target.closest('a')
|
||||
if (closestAnchor) {
|
||||
window.webkit.messageHandlers.mouseDidExit.postMessage(closestAnchor.href);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue