attribute-token-selector-002

[attr~=""]Attribute Selectors with Empty String Values

WeasyPrint

This browser

Assertion
[attr~=''] is valid but matches nothing.

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: [attr~=""]Attribute Selectors with Empty String Values</title>
 5   <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/">
 6   <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">
 7   <meta name="assert" content="[attr~=''] is valid but matches nothing.">
 8   <style type="text/css">
 9     p {
10       color: green;
11     }
12 
13     p.valid {
14       color: red;
15     }
16     [title~=""], [title~=''], p.valid {
17       color: green;
18     }
19     [title~=], p.valid {
20       color: red;
21     }
22 
23     [title~=""] {
24       color: red;
25     }
26   </style>
27 
28  </head>
29  <body>
30   <p class="valid">This sentence must be green.</p>
31   <p title="">This sentence must be green.</p>
32   <p title=" ">This sentence must be green.</p>
33   <p title="  ">This sentence must be green.</p>
34   <p title="q">This sentence must be green.</p>
35 
36  </body>
37 </html>