367220-1.html (1163B)
1 <html> 2 <head> 3 <style id="s"> 4 ol { 5 counter-reset: section; 6 list-style-type: none; 7 } 8 li:before { 9 counter-increment: section; 10 content: counters(section, ".") " "; 11 } 12 </style> 13 14 </head> 15 <body> 16 <ol> 17 <li>item</li> <!-- 1 --> 18 <li>item <!-- 2 --> 19 <ol> 20 <li>item</li> <!-- 2.1 --> 21 <li>item</li> <!-- 2.2 --> 22 <li>item <!-- 2.3 --> 23 <ol> 24 <li>item</li> <!-- 2.3.1 --> 25 <li>item</li> <!-- 2.3.2 --> 26 </ol> 27 <ol> 28 <li>item</li> <!-- 2.3.1 --> 29 <li>item</li> <!-- 2.3.2 --> 30 <li>item</li> <!-- 2.3.3 --> 31 </ol> 32 </li> 33 <li>item</li> <!-- 2.4 --> 34 </ol> 35 </li> 36 <li>item</li> <!-- 3 --> 37 <li>item</li> <!-- 4 --> 38 </ol> 39 <ol> 40 <li>item</li> <!-- 1 --> 41 <li>item</li> <!-- 2 --> 42 </ol> 43 44 <script> 45 s = document.getElementById("s"); 46 t = s.textContent; 47 48 function foo() 49 { 50 document.body.offsetHeight; 51 s.textContent = "ol { color: #ddd}"; 52 document.body.offsetHeight; 53 s.textContent = t; 54 } 55 foo(); 56 </script> 57 58 </body> 59 </html>