Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

event.composedPath()[0] can be very slow: add event.composedTarget? #1070

Open
justinfagnani opened this issue Aug 20, 2024 · 2 comments
Open

Comments

@justinfagnani
Copy link
Contributor

We have a report that event.composedPath() can be slow enough to drastically slow down an initial render that uses it heavily (~29% percent of initial render time).

This use case, and a few others I've seen, only needs the composed target, not the full path, (ie event.composedPath()[0]). Could we add Event.prototype.composedTarget so the full path doesn't need to be materialized?

@EisenbergEffect
Copy link

+1 to this. I hadn't seen the perf issue, but this is a very common pattern with composedPath() and it would make things much easier to teach and understand if a dedicated composedTarget property were available.

@dbatiste
Copy link

dbatiste commented Aug 20, 2024

+1. We use event.composedPath()[0] a whole bunch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants