Returns a selection object that lazily represents an element within the treespace element (or document). Calling [get]Selector#get returns the specified element.
Calling Selector#set replaces the element and calling Selector#delete removes it.

Selector instances are used as the target of the proxy object returned by selector

Example

import { 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>
<main>
<p>P in MAIN</p>
</main>
`;
const slct = new Selector(document.body);
console.log(slct.get('article').textContent); // I am an article
console.log(slct.get('main & p').textContent); // P in MAIN

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

Properties

#proxy?: any
treespace?: Element

Methods