[whatwg/dom] Allow `detail` argument for HTMLElement.click() (#1018)

It would be useful if `HTMLElement.click()` accepted an optional `Number` argument that became the value of the synthetic event's `detail` property (representing the click-count).

Currently, one can do something like `EventTarget.dispatchEvent(new MouseEvent('click', { detail: 1 }))` to achieve more-or-less the same thing, but:

1. it's a bit ugly and cumbersome; and
2. it's not _quite_ the same thing, at least in terms of implementation. For example, in all browsers that I tested, `HTMLElement.click()` has no effect when the target is a disabled button, but when I tried using `EventTarget.dispatchEvent()` to fire a click-event on a disabled button, I found that behavior differed across browsers—e.g., in Safari the event-handler was executed, and in Chrome it was not.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1018

Received on Tuesday, 21 September 2021 19:11:59 UTC