Skip to content

event.composedPath() throws #1875

Open
Open
@bmblb

Description

@bmblb

Description

Trying to read composedPath on event throws exception

Steps to Reproduce

  1. create LWC app like in this playground: https://developer.salesforce.com/docs/component-library/tools/playground/9Xurl1YY9/1/edit
  2. click on Click me div

Expected Results

div
(9) ["DIV", "DIV", undefined, "C-APP", "MAIN", "BODY", "HTML", undefined, undefined]
root
(9) ["DIV", "DIV", undefined, "C-APP", "MAIN", "BODY", "HTML", undefined, undefined]
document
(9) ["DIV", "DIV", undefined, "C-APP", "MAIN", "BODY", "HTML", undefined, undefined]

Actual Results

div
TypeError: Illegal invocation
    at Object.composedPathValue (aura_proddebug.js:473)
    at Object.SecureFunction (aura_proddebug.js:18838)
    at Proxy.eval (active_element_test.js:61)
    at HTMLDivElement.handleEvent (aura_proddebug.js:16832)
    at HTMLDivElement.fnOrObj.$$lwcEventWrapper$$ (aura_proddebug.js:2471)
root
TypeError: Illegal invocation
    at Object.composedPathValue (aura_proddebug.js:473)
    at Object.SecureFunction (aura_proddebug.js:18838)
    at Object.eval (active_element_test.js:52)
    at DocumentFragment.handleEvent (aura_proddebug.js:16832)
    at shadowRootWrappedListener (aura_proddebug.js:567)
    at aura_proddebug.js:650
    at Array.forEach (<anonymous>)
    at invokeListenersByPlacement (aura_proddebug.js:647)
    at HTMLElement.domListener (aura_proddebug.js:657)
document
TypeError: Illegal invocation
    at Object.composedPathValue (aura_proddebug.js:473)
    at Object.SecureFunction (aura_proddebug.js:18838)
    at Object.eval (active_element_test.js:43)
    at HTMLDocument.handleEvent (aura_proddebug.js:16832)
    at HTMLDocument.fnOrObj.$$lwcEventWrapper$$ (aura_proddebug.js:2471)

Browsers Affected

Tested in Chrome

Version

  • "lwc-engine": "1.1.13-224.4"

Additional context/Screenshots
I found a PR which add event.path property: #859
event.path works like composedPath is supposed to, but since it is not in the spec I am not sure if it is safe to use it. I assume it can be removed without a notice? event.composedPath is part of spec though and it would be great to use it, if it wouldn't throw.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions