<span id="thing" class="thing">a thing.</span>
<script>
const myWeakMap = new WeakMap();
// Set a value to a specific node reference.
myWeakMap.set(document.getElementById('thing'), 'some value');
// Access that value by passing the same reference.
console.log(myWeakMap.get(document.querySelector('.thing')); // 'some value'
</script>