javascript - 鼠标悬停时如何获取DOM列表?
问题描述
DOM List
表示 DOM 序列。比如下图。
但这仅在 Chrome 中显示。我无法在 Firefox 中找到路径,并且我搜索了很多资料,有人提供以下代码以兼容。
let path = event.path || (event.composedPath && event.composedPath());
但它没有用。那么,有什么建议吗?
$('body')
.children()
.mouseover(event => {
let path = event.path || (event.composedPath && event.composedPath());
console.log(path); // undefined
});
Firefox 版本:78.0.2(64 位)
解决方案
推荐阅读
- swift - 从 shouldChangeTextIn 更新 UITextView 值返回字符两次
- python - 如何使用多索引过滤器为列分配值?
- javascript - 通常将上下文应用于方法别名
- grouping - 从制表器下载 pdf 时保留 ColumnCalculations 的格式
- python - 启用以记录调试语句
- javascript - 如何在时事通讯表单上实施 Google 的 reCaptcha v3?
- javascript - 添加悬停效果以使用内联样式对 div 做出反应
- nginx - 当proxy_pass通过2个nginx时Websocket 404
- excel - 如果我在 VBA 中创建一个具有相同名称的新实例,会发生什么情况?
- rest - PUT / PATCH 和权限的 REST 最佳实践是什么?