How do get a raw, escaped attribute value from a DOM element so it can be used directly as a selector?
For example:
const selector = test.dataset.mydata;
console.log(selector); //it's not HTML friendly anymore
// selector is unescaped and can't be used directly:
const el = document.querySelector(`[myattr="${selector}"]`);
<div id="test" data-mydata="{"foo":"bar","id":"blah"}"></div>
<div myattr="{"foo":"bar","id":"blah"}"></div>