From 6ace2f1d0d4ac45834e1625e6d9b3bf2195358d4 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sun, 7 May 2017 14:47:44 +0200 Subject: [PATCH] Use direct click method on element #349. Previously there was some hacky target="_blank" setting unsetting logic in the hints click method to force to open a hint into new instance or the same. But this does not work and the hack was previously removed. So there is no need to do the click event emulation by ourselves, it's already available as method on the elements itself. --- src/scripts/hints.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/scripts/hints.js b/src/scripts/hints.js index eeef5b7..1b69c06 100644 --- a/src/scripts/hints.js +++ b/src/scripts/hints.js @@ -366,11 +366,11 @@ var hints = Object.freeze((function(){ if (tag === "input" || tag === "textarea" || tag === "select") { if (type === "radio" || type === "checkbox") { e.focus(); - click(e); + e.click(); return "DONE:"; } if (type === "submit" || type === "reset" || type === "button" || type === "image") { - click(e); + e.click(); return "DONE:"; } e.focus(); @@ -392,7 +392,7 @@ var hints = Object.freeze((function(){ */ window.open(e.getAttribute('href'), '_blank'); } - click(e); + e.click(); } /* set focus on hint with given index valid hints array */ @@ -411,13 +411,6 @@ var hints = Object.freeze((function(){ } } - function click(e) { - mouseEvent(e, "mouseover"); - mouseEvent(e, "mousedown"); - mouseEvent(e, "mouseup"); - mouseEvent(e, "click"); - } - function mouseEvent(e, name) { var evObj = e.ownerDocument.createEvent("MouseEvents"); evObj.initMouseEvent( -- 2.20.1