Optional
treespace: Elementimport { selector } from 'deleight/proxy/selector';
document.body.innerHTML = `
<div>I am a div</div>
<p>I am a paragraph</p>
<section>I am a section</section>
<article>I am an article</article>
`;
const slct = selector(document.body);
console.log(slct.article.textContent); // I am an article
Returns a proxy object that selects an element when a property is requested from it. Setting a property will also replace the selected element and deleting a property will remove the selected element.
By default it uses
querySelector
for string keys andchildren
for number keys.