OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <title>Element.getClientRects() on an SVGElement</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <style> |
| 6 body { |
| 7 margin-left:0px; |
| 8 margin-top:0px; |
| 9 } |
| 10 </style> |
| 11 <body> |
| 12 <svg width="100px" height="100px"> |
| 13 <rect x="20" y="30" width="40" height="50" /> |
| 14 </svg> |
| 15 <svg width="100px" height="100px"> |
| 16 <g> |
| 17 <text x="10" y="10">svg text</text> |
| 18 <foreignObject x="10" y="30" width="50" height="50"> foreign object text </f
oreignObject> |
| 19 </g> |
| 20 </svg> |
| 21 <script> |
| 22 test(function() { |
| 23 var list1 = document.querySelector("rect").getClientRects(); |
| 24 assert_equals(list1.length, 1); |
| 25 var r = list1[0]; |
| 26 assert_equals(r.left, 20); |
| 27 assert_equals(r.top, 30); |
| 28 assert_equals(r.width, 40); |
| 29 assert_equals(r.height, 50); |
| 30 assert_equals(r.right, 60); |
| 31 assert_equals(r.bottom, 80); |
| 32 |
| 33 var gElem = document.querySelector("g"); |
| 34 var list2 = gElem.getClientRects(); |
| 35 assert_equals(list2.length, 1); |
| 36 var r1 = list2[0]; |
| 37 var r2 = gElem.getBoundingClientRect(); |
| 38 assert_equals(r1.left, r2.left); |
| 39 assert_equals(r1.top, r2.top); |
| 40 assert_equals(r1.width, r2.width); |
| 41 assert_equals(r1.height, r2.height); |
| 42 assert_equals(r1.right, r2.right); |
| 43 assert_equals(r1.bottom, r2.bottom); |
| 44 }); |
| 45 </script> |
| 46 </body> |
OLD | NEW |