我在 div 之上有 SVG 层,我想将事件从 SVG 分派到 div 层,该层将 contenteditable 设置为 true,从而使 div 具有焦点。
这是html:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="div1" contenteditable="true" style="width:100px; height:100px; border:solid 1px red; position:absolute; left:0; top:0;">
</div>
<svg height="100" version="1.1" width="100" xmlns="http://www.w3.org/2000/svg" style="position: absolute;left:50px; top:0; border:2px solid blue;pointer-events:none;" id="raphaelCanvasSvg"><desc></desc><defs/></svg>
</body>
</html>
我注意到如果底层 div 包含文本我不需要调度事件,否则我需要。
这是图形表示:
否则:
即使用户单击下面没有文本的部分,是否可以调度事件?
编辑:
为了进一步澄清我的问题,是否有可能在 IE9 中获得与 Firefox 或 Chrome 相同的行为,并使用以下小提琴:
js fiddle