variable-exponential-blowup.html (931B)
1 <!doctype html> 2 <title>CSS Variables Test: Exponential blowup doesn't crash</title> 3 <meta charset="UTF-8"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 7 <link rel="author" href="https://mozilla.org" title="Mozilla"> 8 <link rel="help" href="https://drafts.csswg.org/css-variables/"> 9 <script> 10 let css = ` 11 --v0: "Something really really really long"; 12 `; 13 for (let i = 0; i < 31; ++i) 14 css += `--v${i + 1}: var(--v${i}) var(--v${i});`; 15 let s = document.createElement("style"); 16 s.innerHTML = ` 17 :root { ${css}; } 18 :root::before { content: var(--v31); } 19 `; 20 document.head.appendChild(s); 21 </script> 22 PASS if doesn't crash 23 <script> 24 test(function() { 25 getComputedStyle(document.documentElement, "::before").content; 26 assert_true(true, "Didn't crash"); 27 }); 28 </script>