Famous / Famous/engine

FR: MouseEvent target properties, related nodes

Open
#295 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

Currently `MouseEvent` [copies over](https://github.com/Famous/engine/blob/d60d24446b3d50fc274c8ae9df34b03dab916da3/dom-renderers/events/MouseEvent.js#L37-L152) various event properties, but not the `target` element, presumably since the DOM might only be accessible in another thread.

But certain properties of the target element may be needed, such as the `id`, `tagName`, `classList` and `attributes` of that element. This is important to understand exactly what the user clicked on in the case of a number of potential targets purposefully existing in a single DOMElement.

Regarding the `MouseEvent.node` property, I haven't put too much thought into it, but I imagine we'd need to solve similar problems to DOM eventing and it might be worth following the same convention, whereby `node` would be the node with the DOMElement where the event took place, `currentNode` would be the node with the handler receiving the event (`node` in the current implementation) and `relatedNode` for things like switching between two nodes on mouseenter, etc.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.