1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 https://bugzilla.mozilla.org/show_bug.cgi?id=1119698
6 <title>Test pointer events with image
</title>
7 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
8 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
11 <script class=
"testbody" type=
"text/javascript">
14 SimpleTest.waitForExplicitFinish();
17 var div = document.getElementById(
"div");
18 // Get the coords of the origin of the SVG canvas:
19 var originX = div.offsetLeft;
20 var originY = div.offsetTop;
21 var image4 = document.getElementById(
"image4");
22 var image5 = document.getElementById(
"image5");
24 var background = document.getElementById(
"background");
26 element = document.elementFromPoint(originX +
20, originY +
20);
27 is(element, background,
"Should not hit visibility:hidden image by default");
29 element = document.elementFromPoint(originX +
120, originY +
20);
30 is(element, background,
"Should not hit pointer-events:none image");
32 element = document.elementFromPoint(originX +
220, originY +
20);
33 is(element, background,
"Should not hit pointer-events:visible visibility:hidden image");
35 element = document.elementFromPoint(originX +
320, originY +
20);
36 is(element, image4,
"Should hit pointer-events:painted visibility:hidden image");
38 element = document.elementFromPoint(originX +
420, originY +
20);
39 is(element, image5,
"Should hit pointer-events:stroke visibility:hidden image");
46 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1119698">Mozilla Bug
1119698</a>
50 <div width=
"100%" height=
"1" id=
"div">
52 <svg xmlns=
"http://www.w3.org/2000/svg" xmlns:
xlink=
"http://www.w3.org/1999/xlink" width=
"100%" height=
"100%" id=
"svg">
53 <rect id=
"background" width=
"100%" height=
"100%" fill=
"blue"/>
54 <image x=
"10" y=
"10" width=
"100" height=
"100" visibility=
"hidden" xlink:
href=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAxJREFUCNdj+M/AAAADAQEAGN2NsAAAAABJRU5ErkJggg"/>
55 <image x=
"110" y=
"10" width=
"100" height=
"100" pointer-events=
"none" xlink:
href=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAxJREFUCNdj+M/AAAADAQEAGN2NsAAAAABJRU5ErkJggg"/>
56 <image x=
"210" y=
"10" width=
"100" height=
"100" pointer-events=
"visible" visibility=
"hidden" xlink:
href=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAxJREFUCNdj+M/AAAADAQEAGN2NsAAAAABJRU5ErkJggg"/>
57 <image id=
"image4" x=
"310" y=
"10" width=
"100" height=
"100" pointer-events=
"painted" visibility=
"hidden" xlink:
href=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAxJREFUCNdj+M/AAAADAQEAGN2NsAAAAABJRU5ErkJggg"/>
58 <image id=
"image5" x=
"410" y=
"10" width=
"100" height=
"100" pointer-events=
"stroke" visibility=
"hidden" xlink:
href=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAxJREFUCNdj+M/AAAADAQEAGN2NsAAAAABJRU5ErkJggg"/>