0

Is it possible to get all event listeners from a target element, delete them, and create a mock one, but passed with the event being {altKey: true}? For example,

function getListeners(element){

//find all click listeners and return an array of the functions being called in the listener, e.g. ["function(e){alert('Is alt being pressed: '+e.altKey);}","doSomething", etc]

//delete all of these listeners

/*using the returned value, 

for(var i = 0; i<returnedValue.length; i++){
document.addEventListener('click',eval(returnedValue[i]);

//somehow edit the function so it’s parameter is {altKey:true}, or a modified event object, with altKey set to true, like e.altKey = true; function(e){}

//POSSIBLE SOLUTION: “e.altKey = true; ” + returnedValue[i]

}
*/
}

henxdl
  • 118
  • 14

0 Answers0