tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

url-whitespace-consumption.html (965B)


      1 <!doctype html>
      2 <title>url whitespace consumption</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <style>
      6 
      7 .foo {}
      8 
      9 </style>
     10 
     11 <meta name=author title="Tab Atkins-Bittner">
     12 <link rel=help href="https://drafts.csswg.org/css-syntax/#consume-ident-like-token">
     13 
     14 <script>
     15 
     16 function roundTripUrl(input) {
     17    const rule = document.styleSheets[0].cssRules[0].style;
     18    const fallback = 'url("fallback")';
     19    rule.setProperty("background-image", fallback);
     20    rule.setProperty("background-image", input);
     21    const value = rule.getPropertyValue("background-image");
     22    if(value == fallback) return false;
     23    return value;
     24 }
     25 
     26 test(()=>{
     27    assert_equals(roundTripUrl('url("foo")'), 'url("foo")');
     28    assert_equals(roundTripUrl('url( "foo")'), 'url("foo")');
     29    assert_equals(roundTripUrl('url("foo" )'), 'url("foo")');
     30 }, "whitespace is optional between url( token and the string token");
     31 
     32 </script>