Use direct click method on element #349.
authorDaniel Carl <danielcarl@gmx.de>
Sun, 7 May 2017 12:47:44 +0000 (14:47 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sun, 7 May 2017 12:47:44 +0000 (14:47 +0200)
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

index eeef5b7..1b69c06 100644 (file)
@@ -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(