[whatwg/dom] The dispatch algorithm should account for changing the target to the associated labeled control, if available (#749)

There's a separate [issue](https://github.com/whatwg/html/issues/4516) for adapting the whatwg/html spec.

When a label has an associated [labeled control](https://html.spec.whatwg.org/#labeled-control), the [dispatch algorithm](https://dom.spec.whatwg.org/#concept-event-dispatch) should adjust the target to the labeled control. See for instance the first example at https://html.spec.whatwg.org/#the-label-element. It seems this would match the behavior of at least Firefox and Chrome (tested on Windows, Ubuntu and OSX).

E.g.:
```
data:text/html,<label id="cb-label">CB <input type="checkbox" id="cb"></label> <script> e = new MouseEvent("click"); document.getElementById("cb-label").dispatchEvent(e); </script>
```

-- 
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/749

Received on Tuesday, 9 April 2019 13:20:33 UTC