mouseEvent-offsetXY-svg.html (1052B)
1 <!doctype html> 2 <title>MouseEvent.offsetX/Y returns coordinates relative to the root svg</title> 3 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 4 <link rel="author" title="Mozilla" href="https://mozilla.org"> 5 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1684973"> 6 <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/1508"> 7 <link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsetx"> 8 <script src=/resources/testharness.js></script> 9 <script src=/resources/testharnessreport.js></script> 10 <script src="/resources/testdriver.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <style> 13 body { margin: 0 } 14 </style> 15 <svg width=100 height=100> 16 <rect width=30 height=30 x=50 y=50 fill=green></rect> 17 </svg> 18 <script> 19 let t = async_test(); 20 let rect = document.querySelector("rect"); 21 rect.addEventListener("click", t.step_func_done(function(e) { 22 assert_true(e.offsetX >= 50); 23 assert_true(e.offsetY >= 50); 24 })) 25 26 test_driver.click(rect); 27 </script>