Class AttrSelector

Returns a selection object that lazily represents an attribute with the name within the treespace element (or document). Calling [get]AttrSelector#get returns the attribute in the specified element. Calling AttrSelector#set updates the attribute and calling AttrSelector#delete removes it.

AttrSelector instances are also used as the target of the proxy object returned by attr

Example

import { attr } from 'apption';
document.body.innerHTML = `
<div>I am a div</div>
<p class="main">I am a paragraph</p>
<section>I am a section</section>
<article>I am an article</article>
`;
const slct = new AttrSelector('class', document.body);
console.log(slct.get('p')); // main

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

Properties

#private: any
name: string
treespace?: Element

Methods

  • Parameters

    • key: any

    Returns void

  • Parameters

    • key: any

    Returns any

  • Returns any

  • Parameters

    • key: any
    • value: any

    Returns void