Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface xjs_ParentNode

Wrapper for a ParentNode.

see

https://www.w3.org/TR/dom/#interface-parentnode

Hierarchy

  • xjs_ParentNode

Implemented by

Index

Methods

append

  • append(...contents: Content[]): this
  • ParentNode#append, but return this object when done.

    This method exists simply for chaining.

    let strong = document.createElement('strong')
    strong.textContent = 'hello'
    let em = document.createElement('em')
    let mark = document.createElement('mark')
    
    this.append(...[
        strong,                                       // DOM Node
        ` to the `,                                   // string
        new Comment(`great`),                         // DOM Node
        `<small>big</small> `,                        // string with HTML
        new xjs.Element(em).addContent(`world`).node, // DOM Node (unwrapped)
        null,                                         // null
        new xjs.Element(mark).addContent(`!`),        // wrapped DOM Node
    ]).node.querySelector('body').innerHTML
    // `<strong>hello</strong> to the <!--great--><small>big</small> <em>world</em><mark>!</mark>`
    see

    https://dom.spec.whatwg.org/#dom-parentnode-append

    Parameters

    • Rest ...contents: Content[]

      the contents to append

    Returns this

    this

prepend

  • prepend(...contents: Content[]): this
  • ParentNode#prepend, but return this object when done.

    This method exists simply for chaining.

    let strong = document.createElement('strong')
    strong.textContent = 'hello'
    let em = document.createElement('em')
    let mark = document.createElement('mark')
    
    this.prepend(...[
        strong,                                       // DOM Node
        ` to the `,                                   // string
        new Comment(`great`),                         // DOM Node
        `<small>big</small> `,                        // string with HTML
        new xjs.Element(em).addContent(`world`).node, // DOM Node (unwrapped)
        null,                                         // null
        new xjs.Element(mark).addContent(`!`),        // wrapped DOM Node
    ]).node.querySelector('body').innerHTML
    // `<strong>hello</strong> to the <!--great--><small>big</small> <em>world</em><mark>!</mark>`
    see

    https://dom.spec.whatwg.org/#dom-parentnode-prepend

    Parameters

    • Rest ...contents: Content[]

      the contents to prepend

    Returns this

    this

querySelector

querySelectorAll

Generated using TypeDoc