https://github.com/whatwg/html/pull/7908
The <input pattern> attribute allows developers to specify a regular expression pattern against which the input’s values are checked for validity.
When the pattern attribute was first implemented, these regular expressions were compiled without any RegExp flags. In 2014, the HTML Standard changed this by implicitly enabling the u flag for the pattern attribute, enabling better Unicode support (including support for Unicode character properties like \p{Letter}). This change shipped in Chrome 53.
Now, we’re taking this to the next level by enabling the new RegExp v flag instead of u, enabling the use of set notation, string literal syntax, and Unicode properties of strings.
(Context: The RegExp v flag is a JavaScript language feature which previously went through the Blink Intents process and shipped in Chrome 112. This new ChromeStatus entry is specifically about integrating it with the HTML pattern attribute.)
unicode, regexp, pattern, validation
Not applicable
The spec patch at https://github.com/whatwg/html/pull/7908 lists the potentially breaking changes. Some patterns that previously would compile, now throw an early error with the v flag — specifically those with a character class including either an unescaped special character or a double punctuator.
We expect such patterns to be rare. To validate this assumption we’ve added a UseCounter called HTMLPatternRegExpUnicodeSetIncompatibilitiesWithUnicodeMode in M112, which tracks patterns in any JavaScript u RegExps generated via the HTML pattern attribute that would throw if they were used with the v flag.
Importantly, note that any throwing pattern gracefully degrades — it simply behaves as if the pattern attribute wasn’t present, resulting in inputElement.validity.valid === true for any input value. Consequently, the only compatibility risk is that some value/pattern combinations that would previously result in inputElement.validity.valid being false now result in it being true. Thus, for every UseCounter hit, it could still be that there is no actual breakage — the UseCounter just gives us the upper bound. The currently available data from Beta suggests the UseCounter hits for 0.0393% of Chrome page loads.
Gecko: Positive (Mozilla standards position request, implementation tracking issue)
WebKit: Positive (WebKit standards position request, implementation tracking issue)
Web developers: No signals
Other signals:
The pattern attribute is already well-supported in DevTools and other tooling; no changes are necessary.
Yes
Pull Request: https://github.com/web-platform-tests/wpt/pull/38547
N/A
False
https://bugs.chromium.org/p/chromium/issues/detail?id=1412729
https://mathiasbynens.be/demo/pattern-u-vs-v
M114
https://chromestatus.com/feature/5149507107422208
Hey Mathias,
I'm somewhat curious to see how much that UseCounter will grow (if at all) when 112 goes to stable next week...
Do you have any concerns about certain inputs being sent to a
server that might not have any backend validation, that would
previously be prevented by the u-vintage validation?
Gecko: Positive (Mozilla standards position request, implementation tracking issue)
WebKit: Positive (WebKit standards position request, implementation tracking issue)
Web developers: No signals
Other signals:
Debuggability
The pattern attribute is already well-supported in DevTools and other tooling; no changes are necessary.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes
Is this feature fully tested by web-platform-tests?
Pull Request: https://github.com/web-platform-tests/wpt/pull/38547
Flag name
N/A
Requires code in //chrome?
False
Tracking bug
https://bugs.chromium.org/p/chromium/issues/detail?id=1412729
Sample links
https://mathiasbynens.be/demo/pattern-u-vs-v
Estimated milestones
M114
Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5149507107422208
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CADizRgaAq4FwzJbUqLQVo%2BQdd_V0PT7rBr510OGe8fenHA%3D3HQ%40mail.gmail.com.
Do you have any concerns about certain inputs being sent to a server that might not have any backend validation, that would previously be prevented by the u-vintage validation?
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/c9571b2a-a35b-3824-0f37-c93a9bb522fc%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CADizRgYxU2v2ANQgzNiLD%2B4P-qJHxzTYJfRDsKNCtY0Yb_0bdg%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CADizRgaAq4FwzJbUqLQVo%2BQdd_V0PT7rBr510OGe8fenHA%3D3HQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/c9571b2a-a35b-3824-0f37-c93a9bb522fc%40chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
I don't understand why TAG review is not applicable for this intent.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CADizRgaAq4FwzJbUqLQVo%2BQdd_V0PT7rBr510OGe8fenHA%3D3HQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/c9571b2a-a35b-3824-0f37-c93a9bb522fc%40chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/bf73fe5b-fde2-42df-90f0-582a905d1948n%40chromium.org.
I wonder if we can get enough confidence with less work than investigating 40 randomly chosen sites from UseCounter hits.This is a population proportion problem, and https://sample-size.net/confidence-interval-proportion/ is a useful tool. If you check 40 cases and find no breakage (N=40, x=0) that gives us 95% confidence that breakage is less than 7.2% of samples in this data set. If it's useful to check that much depends on the value of the use counter.Is https://chromestatus.com/metrics/feature/timeline/popularity/4463 the right use counter, and has it reached stable yet? Why is marked as obsolete?For purposes of illustration, let's use 0.04% from earlier in the thread and say we want to be (95%) confident that real breakage is less than 0.01%. Then we just need to get below 25% in the linked tool, and checking 11 samples and finding nothing is enough to do this.
I wonder if we can get enough confidence with less work than investigating 40 randomly chosen sites from UseCounter hits.This is a population proportion problem, and https://sample-size.net/confidence-interval-proportion/ is a useful tool. If you check 40 cases and find no breakage (N=40, x=0) that gives us 95% confidence that breakage is less than 7.2% of samples in this data set. If it's useful to check that much depends on the value of the use counter.Is https://chromestatus.com/metrics/feature/timeline/popularity/4463 the right use counter, and has it reached stable yet? Why is marked as obsolete?
On Wed, Apr 19, 2023 at 3:41 PM Philip Jägenstedt <foo...@chromium.org> wrote:I wonder if we can get enough confidence with less work than investigating 40 randomly chosen sites from UseCounter hits.This is a population proportion problem, and https://sample-size.net/confidence-interval-proportion/ is a useful tool. If you check 40 cases and find no breakage (N=40, x=0) that gives us 95% confidence that breakage is less than 7.2% of samples in this data set. If it's useful to check that much depends on the value of the use counter.Is https://chromestatus.com/metrics/feature/timeline/popularity/4463 the right use counter, and has it reached stable yet? Why is marked as obsolete?For purposes of illustration, let's use 0.04% from earlier in the thread and say we want to be (95%) confident that real breakage is less than 0.01%. Then we just need to get below 25% in the linked tool, and checking 11 samples and finding nothing is enough to do this.I like your more sophisticated math, but it's <0.001% that we want I'm afraid, not 0.01%. So, if I'm following your instructions right, that's ~42 samples to have 95% confidence :-)Of course 0.001% is just a rough guideline that has often proven to be too high or too low. So this is all a judgement call anyway.