tor-browser

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

transform-translate-single-parameter.html (848B)


      1 <!DOCTYPE HTML>
      2 <link rel="help" href="https://svgwg.org/svg2-draft/coords.html#InterfaceSVGTransform">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <body>
      6 
      7 <svg width="200" height="100" xmlns="http://www.w3.org/2000/svg">
      8  <rect x="10" y="10" width="180" height="80" fill="red" />
      9 </svg>
     10 
     11 <script>
     12 test(() => {
     13 const rectElement = document.querySelector("rect");
     14 
     15 // Apply single parameter translate - should behave as translate(100, 0)
     16 rectElement.setAttribute("transform", "translate(100)");
     17 
     18 assert_equals(rectElement.getAttribute('transform'), "translate(100)");
     19 
     20 assert_equals(rectElement.transform.baseVal.getItem(0).matrix.e, 100);
     21 assert_equals(rectElement.transform.baseVal.getItem(0).matrix.f, 0);
     22 
     23 }, 'Dynamic update of transform; setAttribute()');
     24 </script>
     25 </body>
     26 </html>