Trigger all browser events using dispatchEvent

316
February 10, 2017, at 09:03 AM

I'm thinking about building a tool that converts all browser events (either native dom events like .click() or jQuery events) to a standard form.

The standard form is: HTMLElement.dispatchEvent(new Event(eventType, eventInitDict))

For example, I want to change HTMLElement.click() to HTMLElement.dispatchEvent(new Event("click", {"bubbles": true, ...})) for all events.

My question:

  1. Is there a complete mapping from events to this standard form and if so, is it documented anywhere?
  2. Are there any events that could be fired that couldn't be converted to this standard form?
  3. Does jQuery do anything fancy where I wouldn't be able to do this conversion.

It is imperative that I completely convert all events into this format... None can be spared!

Thanks!

Why am I trying to do this?

I am trying to capture all events fired by a Chrome extension. To do this, I've decided to modify an extensions content script before it is injected into the page (I don't care about background page or popup pages) so all events triggered are "tagged" as originating from an extension (this will be added to the eventInitDict in the examples above. I'm modifying Chromium to do this.

PS. I couldn't think of a better question title but if you have one, please let me know / change it.

READ ALSO
Access children of items inside a Lightning Component

Access children of items inside a Lightning Component

I have my lightning component set up like this:

313
Idangerous swiper custom Angular Directive

Idangerous swiper custom Angular Directive

I have taken reference from this Stack Overflow question, everything works fine but in console after minification of my js files, am seeing this error, when ever the swipe is made on the carousel

417
Semantic-ui pop up z-index?

Semantic-ui pop up z-index?

http://semantic-uicom/modules/popup

295
PaperJS display text after/while event (mouse)

PaperJS display text after/while event (mouse)

I have made this poopie little drawing script : Drawing app It's meant for a websiteI have also made a nice interface, where you can draw things with 3 different pencils

304