error.https.html (1234B)
1 <!DOCTYPE html> 2 <html class=reftest-wait> 3 <link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#invoke-a-layout-callback"> 4 <link rel="match" href="fallback-layout-fallback-ref.html"> 5 <meta name="assert" content="This test checks that a layout() class with a throwing layout function will fallback to block layout." /> 6 <style> 7 .test { 8 background: red; 9 border: solid 2px; 10 width: 100px; 11 } 12 13 .float { 14 float: left; 15 width: 50%; 16 height: 100px; 17 } 18 19 .fc { 20 display: flow-root; 21 height: 100px; 22 } 23 24 @supports (display: layout(throwing-layout)) { 25 .test { 26 display: layout(throwing-layout); 27 background: green; 28 } 29 } 30 </style> 31 <script src="/common/reftest-wait.js"></script> 32 <script src="/common/worklet-reftest.js"></script> 33 34 <!-- This tests that when the "layout()" layout function fails, it will fallback to block layout. --> 35 <div class="test"> 36 <div class="float"></div> 37 <div class="fc"></div> 38 </div> 39 40 <script id="code" type="text/worklet"> 41 registerLayout('throwing-layout', class { 42 async intrinsicSizes() {} 43 async layout() { throw Error('fail!'); } 44 }); 45 </script> 46 47 <script> 48 importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent); 49 </script> 50 </html>