1111< h1 > < code > pattern</ code > attribute</ h1 >
1212< div style ="display: none ">
1313 < input pattern ="[a-z]{3} " value ="abcd " id ="basic ">
14+
1415 < input pattern ="a.b " value ="a𝌆b " id ="unicode-code-points ">
15- < input pattern ="\p{ASCII_Hex_Digit}+ " value ="c0ff33 " id ="unicode-property-escape ">
16+ < input pattern ="\p{ASCII_Hex_Digit}+ " value ="c0ff33 " id ="unicode-property ">
17+
18+ < input pattern ="\p{RGI_Emoji}+ " value ="😘💋 " id ="unicode-property-of-strings ">
19+ < input pattern ="[\p{ASCII_Hex_Digit}--[Ff]] " value ="0123456789abcdefABCDEF " id ="set-difference ">
20+ < input pattern ="[_\q{a|bc|def}] " value ="q " id ="string-literal ">
21+
22+ < input pattern ="[(] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-01 ">
23+ < input pattern ="[)] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-02 ">
24+ < input pattern ="[[] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-03 ">
25+ < input pattern ="[]] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-04 ">
26+ < input pattern ="[{] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-05 ">
27+ < input pattern ="[}] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-06 ">
28+ < input pattern ="[/] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-07 ">
29+ < input pattern ="[-] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-08 ">
30+ < input pattern ="[|] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-09 ">
31+
32+ < input pattern ="[&&] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-10 ">
33+ < input pattern ="[!!] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-11 ">
34+ < input pattern ="[##] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-12 ">
35+ < input pattern ="[$$] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-13 ">
36+ < input pattern ="[%%] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-14 ">
37+ < input pattern ="[**] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-15 ">
38+ < input pattern ="[++] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-16 ">
39+ < input pattern ="[,,] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-17 ">
40+ < input pattern ="[..] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-18 ">
41+ < input pattern ="[::] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-19 ">
42+ < input pattern ="[;;] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-20 ">
43+ < input pattern ="[<<] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-21 ">
44+ < input pattern ="[==] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-22 ">
45+ < input pattern ="[>>] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-23 ">
46+ < input pattern ="[??] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-24 ">
47+ < input pattern ="[@@] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-25 ">
48+ < input pattern ="[``] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-26 ">
49+ < input pattern ="[~~] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-27 ">
50+ < input pattern ="[_^^] " value ="foo " class ="breaking-change-from-u-to-v " id ="breaking-change-from-u-to-v-28 ">
1651</ div >
1752< div id ="log "> </ div >
1853< script >
@@ -35,8 +70,38 @@ <h1><code>pattern</code> attribute</h1>
3570 } , "<input pattern> is Unicode code point-aware" ) ;
3671
3772 test ( ( ) => {
38- const input = document . querySelector ( "#unicode-property-escape " ) ;
73+ const input = document . querySelector ( "#unicode-property" ) ;
3974 assert_true ( input . validity . valid ) ;
4075 assert_true ( input . matches ( ":valid" ) ) ;
4176 } , "<input pattern> supports Unicode property escape syntax" ) ;
77+
78+ test ( ( ) => {
79+ const input = document . querySelector ( "#unicode-property-of-strings" ) ;
80+ assert_true ( input . validity . valid ) ;
81+ assert_true ( input . matches ( ":valid" ) ) ;
82+ } , "<input pattern> supports Unicode property escape syntax for properties of strings" ) ;
83+
84+ test ( ( ) => {
85+ const input = document . querySelector ( "#set-difference" ) ;
86+ assert_false ( input . validity . valid ) ;
87+ assert_false ( input . matches ( ":valid" ) ) ;
88+ } , "<input pattern> supports set difference syntax" ) ;
89+
90+ test ( ( ) => {
91+ const input = document . querySelector ( "#string-literal" ) ;
92+ assert_false ( input . validity . valid ) ;
93+ assert_true ( input . matches ( ":invalid" ) ) ;
94+ } , "<input pattern> supports string literal syntax" ) ;
95+
96+ test ( ( ) => {
97+ const inputs = document . querySelectorAll ( "input.breaking-change-from-u-to-v" ) ;
98+ // These examples are all written such that they’re all `:invalid`
99+ // when using `u`, but would become `:valid` when using `v` because
100+ // the pattern would error, in turn resulting in
101+ // `validity.valid: true`.
102+ for ( const input of inputs ) {
103+ assert_true ( input . validity . valid ) ;
104+ assert_true ( input . matches ( ":valid" ) ) ;
105+ }
106+ } , "<input pattern> enables the RegExp v flag" ) ;
42107</ script >
0 commit comments