【问题标题】:event.path return undefined on Google Chromeevent.path 在 Google Chrome 上返回 undefined
【发布时间】:2023-01-31 07:14:30
【问题描述】:

我曾经使用event.path[0].id来检查mousemove的来源,但现在我有一个错误告诉我event.path is undefined

【问题讨论】:

    标签: javascript google-chrome


    【解决方案1】:

    event.path 已被弃用,并在 109 版本的 Google Chrome 中被删除。 https://chromestatus.com/feature/5726124632965120

    您仍然可以使用此代码跨平台:

    function getEventPath(e) {
        return e.path || (e.composedPath && e.composedPath());
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-19
      • 2019-01-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多