-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Why aren't ValidityState[tooLong|tooShort] supported? #2493
Comments
The comment pretty clearly explains why, I think. Please provide a code example that works in the browser but not jsdom and we can consider this further. Until then, closing. |
I opened the issue because I don't understand the comment... |
I'm very sorry; I skimmed and missed that you had already read the comment. I didn't mean to be dismissive. The comment means that tooLong and tooShort cannot be caused by JavaScript, only user interaction (i.e., an actual user clicking and typing things on the screen). Since jsdom is a JavaScript library with a JavaScript API, and not a true web browser that you can click on and type things in to, tooLong and tooShort cannot be triggered in jsdom. It's possible the comment is incorrect; I haven't read or investigated these parts of the spec in detail. But if the comment were incorrect, then you'd be able to provide a piece of JavaScript that works in the browser but not in jsdom. Thus my request. |
No worries - I'll admit I didn't dig too deep beyond the comment either. The second link in the code contains a link to the dirty value attribute, which made it clearer to me. For kicks, I pout together a codepen to confirm the comment is still accurate: https://codepen.io/brophdawg11/pen/aPgqVE |
Basic info:
Minimal reproduction case
n/a
I don't have a specific example, rather a question about the source code. Can someone elaborate on this code comment and why
tooLong
andtooShort
can't be implemented?https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/nodes/HTMLInputElement-impl.js#L777
It doesn't appear that other string-input validations require user-interactions (i.e.,
patternMismatch
). It is quite frustrating to only be able to test portions of theValidityState
API usingjsdom
.How does similar code behave in browsers?
ValidityState is fully functional
The text was updated successfully, but these errors were encountered: