是否可以在页面中获取所选文本的父元素?例如:
<div class="someparent">
Selection of this text should refer to the 'someparent' class.
<span class="spanparent">If this is selected, the parent should be this span</span>
</div>
Run Code Online (Sandbox Code Playgroud)
因为在获取所选文本时,它通常从窗口或文档中获取它(取决于浏览器),但是可以获取所选文本的父元素吗?