Skip to content

Conversation

@oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Jul 21, 2018

Closes #12205. Using event.target.dataset doesn't make much sense in this context. The target could be coming from any element that triggered the click event. People can use event.currentTarget.dataset instead.


event.target = { ...target, value, name };

The current spread syntax is pointless. The spread operator is using the iteration protocols to navigate over elements and collect the results (with arrays) or to copy enumerable properties (with objects).
But:

{...document.createElement('div')} // === {}

Instead, let's make a bold move. Yes, we try to make the event match the native change event at the cost of altering the event.

event.target = { value, name };

@oliviertassinari oliviertassinari added the scope: select Changes related to the select. label Jul 21, 2018
@rgallison
Copy link

rgallison commented Jan 16, 2024

People can use event.currentTarget.dataset instead.

Trying to do so with a TextField select and currentTarget is null. We ended up mutating the value of the options to access additional information about the option clicked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: select Changes related to the select.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Select] onChange - accessing data-* attributes

2 participants