matching-brackets-001

Matching brackets and quotes for @rules

WeasyPrint

This browser

Flags
invalid
Assertion
User agents must handle unexpected tokens encountered while parsing an at-rule by reading until the end of the statement, while observing the rules for matching pairs of brackets and quotes, and correctly handling escapes.

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3  <head>
 4   <title>CSS Test: Matching brackets and quotes for @rules</title>
 5   <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
 6   <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors">
 7   <link rel="help" href="http://www.w3.org/TR/CSS21/media.html#at-media-rule">
 8   <meta name="flags" content="invalid">
 9   <meta name="assert" content="User agents must handle unexpected tokens     encountered while parsing an at-rule by reading until the end of the     statement, while observing the rules for matching pairs of brackets     and quotes, and correctly handling escapes. ">
10   <style type="text/css">
11     p {
12       color: red;
13       background: red;
14     }
15     #semicolon { background: transparent; }
16     @foo ] } ) test-token \
17      ~ ` ! @ # $ % ^ & * - _ + = | : > < ? / , .
18      [\]\5D ']' "]"; # { background: red; } ]
19      (\)\29 ')' ")"; #semicolon { background: red; } } } } )
20      '; #semicolon { background: red; } } } }',
21      "; #semicolon { background: red; }' } } }"
22     ;
23     #semicolon { color: green; }
24     #block { background: transparent; }
25     @foo ] } ) test-token \
26      ~ ` ! @ # $ % ^ & * - _ + = | : > < ? / , .
27      [\]\5D ']' "]"; #block { background: red; } ]
28      (\)\29 ')' ")"; #block { background: red; } )
29      '\'; #block { background: red; }',
30      "\"; #block { background: red; }'"
31      {\}\79 '}' "}"; #block { background: red; }
32         #block { background: red; } }
33     #block { color: green; }
34   </style>
35  </head>
36  <body>
37   <p id="semicolon">This sentence must be green.</p>
38   <p id="block">This sentence must be green.</p>
39  </body>
40 </html>