双击contenteditable返回父元素内的锚标记作为Firefox中的选择对象。如何解决此问题,以便可以获取所选元素的对象。
$(".test").dblclick(function(){
console.log(window.getSelection());
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="test" contenteditable="true">
This is the link to
<a href="google.com">google. You can click here.</a>
</div>