| OLD | NEW |
| (Empty) |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <style> | |
| 5 body { | |
| 6 font-family: monospace; | |
| 7 font-size: 1em; | |
| 8 } | |
| 9 p { | |
| 10 margin: 0; | |
| 11 line-height: 1em; | |
| 12 } | |
| 13 .container { | |
| 14 background-color: lightgray; | |
| 15 width: 15em; | |
| 16 height: 5em; | |
| 17 } | |
| 18 /* selector specificity | |
| 19 #id => 100 | |
| 20 .class => 10 | |
| 21 element => 1 | |
| 22 */ | |
| 23 /* | |
| 24 selector position | |
| 25 in style="" attribute | |
| 26 in <style/> element / external file | |
| 27 */ | |
| 28 | |
| 29 /* Testing selector specificity is respected in @region style bl
ocks */ | |
| 30 #f1 { | |
| 31 -webkit-flow-into: flow1; | |
| 32 } | |
| 33 #r1 { | |
| 34 -webkit-flow-from: flow1; | |
| 35 } | |
| 36 @-webkit-region #r1 { | |
| 37 * { | |
| 38 background-color: yellow; | |
| 39 } | |
| 40 p { | |
| 41 background-color: lightgreen; | |
| 42 } | |
| 43 .cr1 { | |
| 44 background-color: lime; | |
| 45 } | |
| 46 #p1 { | |
| 47 background-color: green; | |
| 48 } | |
| 49 } | |
| 50 | |
| 51 /* Testing selector position is respected in @region style block
s */ | |
| 52 #f2 { | |
| 53 -webkit-flow-into: flow2; | |
| 54 } | |
| 55 #r2 { | |
| 56 -webkit-flow-from: flow2; | |
| 57 } | |
| 58 @-webkit-region #r2 { | |
| 59 p, .cr21, #p2 { | |
| 60 background-color: red; | |
| 61 } | |
| 62 } | |
| 63 @-webkit-region #r2 { | |
| 64 p { | |
| 65 background-color: lightgreen; | |
| 66 } | |
| 67 .cr22 { | |
| 68 background-color: lime; | |
| 69 } | |
| 70 #p2 { | |
| 71 background-color: green; | |
| 72 } | |
| 73 } | |
| 74 | |
| 75 /* More specific selector in flowed content than in @region styl
e */ | |
| 76 .c3 { | |
| 77 background-color: lime; | |
| 78 } | |
| 79 #p31, #p32 { | |
| 80 background-color: lime; | |
| 81 } | |
| 82 #f3 { | |
| 83 -webkit-flow-into: flow3; | |
| 84 } | |
| 85 #r3 { | |
| 86 -webkit-flow-from: flow3; | |
| 87 } | |
| 88 @-webkit-region #r3 { | |
| 89 p, .cr3 { | |
| 90 background-color: red; | |
| 91 } | |
| 92 } | |
| 93 | |
| 94 /* Flowed content has style attribute */ | |
| 95 #f4 { | |
| 96 -webkit-flow-into: flow4; | |
| 97 } | |
| 98 #r4 { | |
| 99 -webkit-flow-from: flow4; | |
| 100 } | |
| 101 @-webkit-region #r4 { | |
| 102 p, #p4, .cr4 { | |
| 103 background-color: red; | |
| 104 } | |
| 105 } | |
| 106 </style> | |
| 107 </head> | |
| 108 <body> | |
| 109 <!-- Flowed content --> | |
| 110 <div id='f1'> | |
| 111 <p>Plain paragraph</p> | |
| 112 <p class='cr1'>Styled with class</p> | |
| 113 <p id='p1'>Styled with ID</p> | |
| 114 </div> | |
| 115 <div id='f2'> | |
| 116 <p>Plain paragraph</p> | |
| 117 <p class='cr21 cr22'>Styled with class</p> | |
| 118 <p id='p2'>Styled with ID</p> | |
| 119 </div> | |
| 120 <div id='f3'> | |
| 121 <p class='c3'>Class in content</p> | |
| 122 <p id='p31'>ID in content</p> | |
| 123 <p class='cr3' id='p32'>ID in content</p> | |
| 124 </div> | |
| 125 <div id='f4'> | |
| 126 <p style='background-color: lime;' >Element style in reg
ion</p> | |
| 127 <p style='background-color: lime;' id='p2'>ID style in r
egion</p> | |
| 128 <p style='background-color: lime;' class='cr2'>Class in
region</p> | |
| 129 </div> | |
| 130 | |
| 131 <!-- Regions --> | |
| 132 <h1>Testing CSS selectors specificity/position is respected when
using @region styling</h1> | |
| 133 | |
| 134 Selector specificity in @region rule | |
| 135 <div class='container' id='r1'></div> | |
| 136 Selector position in @region rule | |
| 137 <div class='container' id='r2'></div> | |
| 138 More specific selector in flowed content | |
| 139 <div class='container' id='r3'></div> | |
| 140 Style attribute in flowed content | |
| 141 <div class='container' id='r4'></div> | |
| 142 </body> | |
| 143 </html> | |
| OLD | NEW |