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 the RegExp flag used for input pattern validation #3681
base: main
Are you sure you want to change the base?
Conversation
I think it'd be good to add a test-case too, but I'm not sure what the best approach is. Should I create a new test file or copy https://github.com/web-platform-tests/wpt/blob/master/html/semantics/forms/constraints/form-validation-validity-patternMismatch.html into |
280c2af
to
b699527
Compare
Never mind, I guess the test was skipped in jsdom, so I updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!!
@@ -1107,7 +1107,6 @@ formaction.html: [fail, Unknown] | |||
|
|||
DIR: html/semantics/forms/constraints | |||
|
|||
form-validation-validity-patternMismatch.html: [fail, Unknown] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use fail-node18
here (and below) to signal the right support matrix, and the tests should pass, I think!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip! I added it, but there were more tests that fail. Essentially, any test where the input has a pattern will fail. Should I add more fail-node18
to those tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Well, we don't want to make jsdom (or the pattern parts of it) completely unusable on Node 18, at least until it goes out of LTS support. So I guess we need a fallback, that try/catches with "v" and then falls back to "u".
According to MDN (https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern#overview), the RegExp flag was changed from 'u' to 'v' around mid-2023, so jsdom should update to match that.
b2f5c00
to
328c4c3
Compare
According to MDN (https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern#overview), the RegExp flag was changed from 'u' to 'v' around mid-2023, so jsdom should update to match that.
Fixes: #3680