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

Add tests for <input pattern> enabling the RegExp v flag #38547

Merged

Conversation

mathiasbynens
Copy link
Contributor

Proposal: whatwg/html#7908

Re-opening this as #38325 accidentally got merged.

@annevk
Copy link
Member

annevk commented Mar 31, 2023

@mathiasbynens mathiasbynens force-pushed the input-pattern-regexp-v-flag branch from 2bdb281 to 7640b5b Compare April 3, 2023 07:55
@mathiasbynens
Copy link
Contributor Author

Could you take a look at https://github.com/web-platform-tests/wpt/blob/master/html/semantics/forms/constraints/form-validation-validity-patternMismatch.html? It looks like that needs changes as well.

Done. For now, I’ve changed these tests so that they pass with either u or v. If you prefer to make them fail with u and only pass with v, let me know.

@annevk
Copy link
Member

annevk commented Apr 3, 2023

I think we should make them fail if you use u. That's what HTML will require if this goes through after all.

@mathiasbynens mathiasbynens force-pushed the input-pattern-regexp-v-flag branch from 7640b5b to 67557e0 Compare April 3, 2023 11:52
@mathiasbynens
Copy link
Contributor Author

I think we should make them fail if you use u. That's what HTML will require if this goes through after all.

I figured the other tests (in html/semantics/forms/the-input-element/pattern_attribute.html) already accomplish this, but sure — I’ll duplicate a test from there into the other file.

@mathiasbynens mathiasbynens changed the title [DO NOT MERGE YET] Add tests for <input pattern> enabling the RegExp v flag Add tests for <input pattern> enabling the RegExp v flag Apr 3, 2023
@mathiasbynens mathiasbynens force-pushed the input-pattern-regexp-v-flag branch from 67557e0 to cec34da Compare April 13, 2023 08:31
@mathiasbynens mathiasbynens force-pushed the input-pattern-regexp-v-flag branch from cec34da to 3ee816e Compare April 14, 2023 07:56
@annevk annevk merged commit 000b1c6 into web-platform-tests:master Apr 25, 2023
annevk pushed a commit to whatwg/html that referenced this pull request Apr 25, 2023
This makes the pattern attribute more powerful, enabling the use of RegExp set notation syntax and properties of strings in its values.

Differences with the previous u flag-based behavior:

- [FEATURE] Previously invalid patterns now become valid, e.g.:

    pattern="[\p{ASCII_Hex_Digit}--[Ff]]"
    pattern="\p{RGI_Emoji}"
    pattern="[_\q{a|bc|def}]"

- [BREAKING CHANGE] Some previously valid patterns are now errors, specifically those with a character class including either an unescaped special character ( ) [ ] { } / - \ | or a double punctuator.

- [STATUS QUO] Other previously valid patterns still behave the same. (Other than the above-mentioned features, the v flags only differs in behavior from the u flag w.r.t. case-insensitive matching, but the pattern attribute uses case-sensitive matching.)

Tests: web-platform-tests/wpt#38547.

Fixes #7908.
@mathiasbynens mathiasbynens deleted the input-pattern-regexp-v-flag branch April 25, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants