Qs2el
Create elements from query selector strings.
Install / Use
/learn @WebReflection/Qs2elREADME
qs2el
<sup>Social Media Photo by Matheus Frade on Unsplash</sup>
Create an element from a query selector string.
// as function
const a = qs2el('a#home.special[data-page=home]');
// or as literal
const button = qs2el`button${'.primary'}[disabled]`;
The exported function also have an .escape(value) to safely parse text that might contain [ or ] chars.
const value = 'this [might] be an issue';
const div = qs2el`div[data-blob=${qs2el.escape(value)}]`;
div.dataset.blob === value; // true
