It's no problem to find an element by position and the position of an element in Javascript. But is there are general way to compare them?
The only way I could think of is comparing ids or classnames, but not all elements have ids or classnames.
It's no problem to find an element by position and the position of an element in Javascript. But is there are general way to compare them?
The only way I could think of is comparing ids or classnames, but not all elements have ids or classnames.
=== Operator still relevant https://developer.mozilla.org/en-US/docs/Web/API/Node/isSameNode
Even if you make changes to the DOM, === operator works fine.
const body = document.body; body.setAttribute("test","done"); const _body = document.body; body === _body // true.
:).