I have the following HTML code:
<!DOCTYPE html>
...
<div id="body">
<svg version="1.1" ...>
<defs>
<svg id="svgelid" width="24" height="24" x="0" y="0" version="1.1">
<rect x="0" y="0" width="100%" height="100%" fill="#282828" .../>
<text pointer-events="none" ...>X</text>
</svg>
</defs>
<g id="wrapper">
<svg version="1.1" id="element" width="24" height="24" ...>
<use id="useid" href="#svgelid" ...>
</svg>
</svg>
</svg>
</div>
和 JavaScript 代码:
document.getElementById('body').addEventListener('mouseover', function(e) { // and then mouseout
...
});
如果我将鼠标悬停在#element SVG上,则事件侦听器中的
e.relatedTarget
指向