Skip to content

Conversation

@jairo-bc
Copy link
Contributor

@jairo-bc jairo-bc commented Sep 4, 2020

Some elements on the cornerstone couldn't rely on the currentTarget from the event, because .subscribe() method adds event handler on the document. So the idea is to pass down through the eventemitter not only the event, but also the currentTarget element.

@bigbot
Copy link

bigbot commented Sep 4, 2020

Autotagging @bigcommerce/storefront-team

for (let target = e.target; target && target !== this; target = target.parentNode) {
if (target.matches(elementSelector)) {
handler.call(target, e);
handler.call(target, e, target);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we pass target 2 times now ?

Copy link
Contributor

@junedkazi junedkazi Sep 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the first argument be elementSelector ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first param is for binding this context

@jairo-bc jairo-bc requested a review from MaxGenash September 10, 2020 13:25
@junedkazi junedkazi merged commit f3d8d51 into bigcommerce:master Sep 10, 2020
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

Successfully merging this pull request may close these issues.

4 participants