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 'apption';
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

  • Parameters

    • Optional treespace: Element

    Returns Selector

Properties

#private: any
treespace?: Element

Methods

  • Parameters

    • key: any

    Returns void

  • Parameters

    • key: any

    Returns any

  • Returns any

  • Parameters

    • key: any
    • value: any

    Returns void