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

fix range input if max is changed at same time as value #3871

Merged

Conversation

AlbertLucianto
Copy link
Contributor

Should fix #3857

This bug is caused by html input range where setting value outside the min and max will fallback to the nearest valid value. In this case, it will be the max.

In ElementWrapper, adding bindings happened before adding attributes, which means value is updated before max when updating at the same cycle. I think the issue can be solved by reordering adding attributes to be first.

However, I can't seem to reproduce the input range behaviour in test. I think there's something missing in input range validation in jsdom, so I put a note there. I hope it's okay.

Really appreciate for your review!

@AlbertLucianto AlbertLucianto force-pushed the fix/bind-value-fails-range-max branch from d9a1d96 to 149929b Compare November 9, 2019 02:27
@Rich-Harris Rich-Harris merged commit 5c08465 into sveltejs:master Nov 10, 2019
@Rich-Harris
Copy link
Member

Thank you! This seems like the right way to fix it, I don't think I can think of a situation where you wouldn't want to handle attributes first. Yeah, JSDOM has a few gaps like that. Just can't bring myself to suggest switching the entire test suite over to Puppeteer, it takes long enough to run as it is...

@AlbertLucianto AlbertLucianto deleted the fix/bind-value-fails-range-max branch November 11, 2019 06:37
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.

bind:value fails on range input if max is changed at same time as value
2 participants