cssom-getBoxQuads-002.html (972B)
1 <!DOCTYPE html> 2 <title>CSSOM View - getBoxQuads() returns consistent box for SVG test</title> 3 <link rel="help" href="https://drafts.csswg.org/cssom-view/#the-geometryutils-interface"> 4 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1746794"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <svg width="200" height="200"> 8 <text> 9 <tspan id="t1" x="50 60 70 80 90 100" y="50">hello1</tspan> 10 <tspan id="t2" x="50 60 70 80 90 100" y="100">hello2</tspan> 11 </text> 12 </svg> 13 <script> 14 test(function() { 15 for (let element of document.querySelectorAll("tspan")) { 16 let bcr = element.getBoundingClientRect(); 17 let quad = element.getBoxQuads()[0].getBounds(); 18 for (let prop of ["width", "height", "left", "top"]) { 19 assert_equals(bcr[prop], quad[prop], `${element.id} ${prop}: getBoxQuads should be consistent with getBoundingClientRect`); 20 } 21 } 22 }); 23 </script>