dom-identifier

An utility to retrieve a unique node path, and find it later on

Usage no npm install needed!

<script type="module">
  import domIdentifier from 'https://cdn.skypack.dev/dom-identifier';
</script>

README

dom-identifier

Build Status Coverage Status

An utility to retrieve a unique node path, and find it later on.

import {getNode, getPath} from 'dom-identifier';

const node = document.getElementById('any');
const path = getPath(node);
// [1, 34, 12, 7]

getNode(path) === node;
// true