It could be more performant than stepping through the parents: https://developer.mozilla.org/en-US/docs/Web/API/Node/contains