[FIX] web_tour: correct automatic click on links
Previous implementation was checking if the element we want to click on is a link and if this is the case, only forced a redirection. This had been done because the redirection was not working by simulating a click, but in fact it works, the click simulation only had to be improved. Also, only forcing a redirection is wrong as some links have both a real redirection link and a event handler binded to them.
This commit is contained in:
@@ -96,11 +96,18 @@ var RunningTourActionHelper = core.Class.extend({
|
||||
};
|
||||
},
|
||||
_click: function (values) {
|
||||
var href = values.$element.attr("href");
|
||||
if (href && href.length && href[0] !== "#" && values.$element.is("a") && href !== "javascript:void(0)") {
|
||||
window.location.href = href;
|
||||
} else {
|
||||
values.$element.trigger("mouseenter").mousedown().mouseup().click().trigger("mouseleave");
|
||||
trigger_mouse_event(values.$element, "mouseover");
|
||||
values.$element.trigger("mouseenter");
|
||||
trigger_mouse_event(values.$element, "mousedown");
|
||||
trigger_mouse_event(values.$element, "mouseup");
|
||||
trigger_mouse_event(values.$element, "click");
|
||||
trigger_mouse_event(values.$element, "mouseout");
|
||||
values.$element.trigger("mouseleave");
|
||||
|
||||
function trigger_mouse_event($element, type) {
|
||||
var e = document.createEvent("MouseEvents");
|
||||
e.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, $element[0]);
|
||||
$element[0].dispatchEvent(e);
|
||||
}
|
||||
},
|
||||
_text: function (values, text) {
|
||||
|
||||
Reference in New Issue
Block a user