I did some digging into this as I spent about a day chasing the ‘missing’ composedPath() within the $event object (the answer to this is already in the name of the variable just mentioned).
What’s causing the deprecation notice (in browsers)?
The browsers are scanning the html page and looking for patterns like ‘event.path…’ etc
The simple pattern scan is done out of the assumption that if ‘event.path…’ i.e. ‘event.path[i].foo.etc’
is utilized then the safest assumption on the browsers’ part is that you’re using vanilla JS and thus playing with a deprecated feature (with fire). So they throw up a “world is burning, please update code” sort of warning.
What does Aurelia 2 do?
(I haven’t tested Aurelia 1 so assume worst case without doing your own testing)
Aurelia 2 automatically checks for the presence of event.composedPath() and uses that where it is present.
Please also note that $event !== event (the hint at the beginning of this answer).
You see, $event is an Aurelia 2 provided event object and thus is NOT the vanilla browser event object at all therefore if you go spelunking inside of $event looking for composedPath() you will never find it.
What you will find instead is the plain old path[ ] array.
This was presumably done out of a desire to preserve existing functionality (smart reasoning) in deployed templates.
How to know you’re not dealing with vanilla browser event object?
Visit your index.html file at project root
Add a script tag like so:
Then in your template of choice, file any element and add the following:
By doing this, you are testing the vanilla event object of the browser OUTSIDE of Aurelia’s influence.
In the console.log output (upon clicking to cause the callback to be invoked) you will indeed see
a composedPath() member within the event object.
When you do the same thing within your component .ts (or .js) file inside of Aurelia’s purview, you will and console.log() the passed-in $event object from an equivalently delegated/triggered/captured handler method, YOU WILL NOT SEE composedPath() inside the printed out $event object.
Summary and Conclusion
You may SAFELY IGNORE the deprecation warnings thrown by your browser if and only if you are running Aurelia 2 and your template is using delegate/trigger/capture and passing in the Aurelia generated $event object.