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

Second event handler not correctly registered #200

Open
stephanebisson opened this issue Apr 30, 2024 · 6 comments
Open

Second event handler not correctly registered #200

stephanebisson opened this issue Apr 30, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@stephanebisson
Copy link

It appears that on an element having more than one event handlers (on* attributes), the second one is not correctly registered but the first and third ones are. I haven't tried with more than 3.

Test case: https://codepen.io/stephanebisson/pen/yLrWgzL?editors=1010

@hueitan
Copy link
Contributor

hueitan commented May 1, 2024

The issue causing the second item to be skipped is that the previous attributes are being removed while the loop is still running. To fix this, we should wait until after the loop has finished to remove the attributes.

for (let {name, value} of elem.attributes) {
// If the attribute should be skipped, remove it
if (skipAttribute(name, value)) {
removeAttribute(elem, name);
listen(elem, name, value, events);
continue;
}

@cferdinandi
Copy link
Owner

Fixed!

@cferdinandi cferdinandi added the bug Something isn't working label May 7, 2024
@stephanebisson
Copy link
Author

According to this codepen, v13.0.4 broke this again

@hueitan
Copy link
Contributor

hueitan commented May 21, 2024

According to this codepen, v13.0.4 broke this again

fixed on #204

@stephanebisson
Copy link
Author

The PR above seems to fix the issue. @cferdinandi any chance you can have a look? thanks

@cferdinandi cferdinandi reopened this Aug 3, 2024
@cferdinandi
Copy link
Owner

A recent update reintroduced this bug, unfortunately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants