content-computed.html (3177B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Content Module Level 3: getComputedStyle().content</title> 6 <link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> 7 <link rel="help" href="https://drafts.csswg.org/css-content-3/#content-property"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/css/support/computed-testcommon.js"></script> 11 </head> 12 <body> 13 <!-- Note: we have to make this element 'display:none' so that it doesn't 14 trigger actual image loads from remote web servers when we set its 15 'content' property to e.g. https://www.example.com/picture.svg via the 16 scripted tests below. --> 17 <div id="target" style="display:none"></div> 18 <script> 19 function test_computed_value_combinations(property, specified, computed) { 20 test_computed_value(property, specified, computed); 21 test_computed_value(property, `${specified} / "alt text"`, computed ? `${computed} / "alt text"` : undefined); 22 } 23 24 test_computed_value_combinations("content", "open-quote"); 25 test_computed_value_combinations("content", "close-quote"); 26 test_computed_value_combinations("content", "no-open-quote"); 27 test_computed_value_combinations("content", "no-close-quote"); 28 29 test_computed_value_combinations("content", "counter(counter-name)"); 30 test_computed_value_combinations("content", "counter(counter-name, counter-style)"); 31 test_computed_value_combinations("content", "counter(counter-name, dECiMaL)", "counter(counter-name)"); 32 test_computed_value_combinations("content", "counter(counter-name, DECIMAL)", "counter(counter-name)"); 33 34 test_computed_value_combinations("content", `counters(counter-name, ".")`); 35 test_computed_value_combinations("content", `counters(counter-name, ".", counter-style)`); 36 test_computed_value_combinations("content", `counters(counter-name, ".", dECiMaL)`, `counters(counter-name, ".")`); 37 test_computed_value_combinations("content", `counters(counter-name, ".", DECIMAL)`, `counters(counter-name, ".")`); 38 39 test_computed_value_combinations("content", `url("https://www.example.com/picture.svg")`); 40 41 test_computed_value_combinations("content", `"hello"`); 42 43 test_computed_value_combinations("content", `counter(counter-name) "potato"`); 44 test_computed_value_combinations("content", `counters(counter-name, ".") "potato"`); 45 test_computed_value_combinations("content", `"(" counters(counter-name, ".", counter-style) ")"`); 46 test_computed_value_combinations("content", `open-quote "hello" "world" close-quote`); 47 test_computed_value_combinations("content", `url("https://www.example.com/picture.svg") "hello"`); 48 49 test_computed_value("content", "linear-gradient(to top right, red calc(10% + 2em), blue", "linear-gradient(to right top, rgb(255, 0, 0) calc(10% + 32px), rgb(0, 0, 255))"); 50 test_computed_value("content", "radial-gradient(ellipse 50% 40% at calc(2em + 10px) 30%, red, blue)", "radial-gradient(50% 40% at 42px 30%, rgb(255, 0, 0), rgb(0, 0, 255))"); 51 test_computed_value("content", "conic-gradient(from 1.5708rad, red 0deg, blue calc(180deg - 10deg))", "conic-gradient(from 90.0002deg, rgb(255, 0, 0) 0deg, rgb(0, 0, 255) 170deg)"); 52 53 </script> 54 </body> 55 </html>