layer-media-toggle.html (873B)
1 <!DOCTYPE html> 2 <title>CSS Cascade Layers: Tests against a Chrome bug that modifying a sheet affects existing layers</title> 3 <link rel="help" href="https://drafts.csswg.org/css-cascade-5/#layering"> 4 <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1313357"> 5 <link rel="author" href="mailto:xiaochengh@chromium.org"> 6 <link rel="match" href="reference/ref-filled-green-100px-square.xht"> 7 8 <style> 9 @layer foo, bar; 10 @layer bar { 11 #target { background-color: green; } 12 } 13 @layer foo { 14 #target { background-color: red; } 15 } 16 </style> 17 <style media="print" id="toggle"> 18 #target { 19 width: 100px; 20 height: 100px; 21 } 22 </style> 23 24 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 25 <div id="target"></div> 26 27 <script> 28 document.body.offsetWidth; // Force style calculation 29 document.getElementById('toggle').media = 'all'; 30 </script>