# Class NodeRef

A type-safe wrapper around a DOM Node, HTMLElement, HTML string, NodeList, or an array of Nodes. Provides guarantees around presence and access.

- Defined in src/shared/noderef.js:8

##### Index

### Constructors

constructor

### Properties

initial
isList
linked

### Accessors

dom
element
node
nodelist
nodes
size

### Methods

clone
collection
getAll
getAny
getIndex
isElement
setIndex

## Constructors

### constructor

- new NodeRef(element: string | Node | Element | NodeList | Node[]): NodeRef

  #### Parameters

  - element: string | Node | Element | NodeList | Node[]

    The DOM node(s) or HTML string to wrap.

  #### Returns NodeRef

  #### Throws

  If the argument is invalid or cannot be wrapped properly.

  - Defined in src/shared/noderef.js:13

## Properties

### initial

initial: string | Node | NodeList | Node[]

- Defined in src/shared/noderef.js:15
- Defined in src/shared/noderef.js:34
- Defined in src/shared/noderef.js:48
- Defined in src/shared/noderef.js:59
- Defined in src/shared/noderef.js:65
- Defined in src/shared/noderef.js:72
- Defined in src/shared/noderef.js:75

### isList

isList: boolean

- Defined in src/shared/noderef.js:30
- Defined in src/shared/noderef.js:53
- Defined in src/shared/noderef.js:94
- Defined in src/shared/noderef.js:123

### linked

linked: boolean

- Defined in src/shared/noderef.js:27

## Accessors

### dom

- get dom(): Node | Element | ChildNode | NodeList | Node[]

  #### Returns Node | Element | ChildNode | NodeList | Node[]

  - Defined in src/shared/noderef.js:150

### element

- get element(): Element

  #### Returns Element

  - Defined in src/shared/noderef.js:84
- set element(el: Element): void

  #### Parameters

  - el: Element

  #### Returns void

  - Defined in src/shared/noderef.js:90

### node

- get node(): Node | ChildNode

  #### Returns Node | ChildNode

  - Defined in src/shared/noderef.js:98
- set node(node: Node | ChildNode): void

  #### Parameters

  - node: Node | ChildNode

  #### Returns void

  - Defined in src/shared/noderef.js:104

### nodelist

- get nodelist(): NodeList | Node[]

  #### Returns NodeList | Node[]

  - Defined in src/shared/noderef.js:133

### nodes

- get nodes(): Node[]

  #### Returns Node[]

  - Defined in src/shared/noderef.js:127
- set nodes(nodes: Node[]): void

  #### Parameters

  - nodes: Node[]

  #### Returns void

  - Defined in src/shared/noderef.js:117

### size

- get size(): number

  #### Returns number

  - Defined in src/shared/noderef.js:156

## Methods

### clone

- clone(): NodeRef

  #### Returns NodeRef

  - Defined in src/shared/noderef.js:216

### collection

- collection(): Element[] | Node[]

  #### Returns Element[] | Node[]

  - Defined in src/shared/noderef.js:179

### getAll

- getAll(): Node | Element | ChildNode | Node[]

  #### Returns Node | Element | ChildNode | Node[]

  - Defined in src/shared/noderef.js:170

### getAny

- getAny(): Node | Element | ChildNode

  #### Returns Node | Element | ChildNode

  - Defined in src/shared/noderef.js:161

### getIndex

- getIndex(index: number): Node | Element | ChildNode

  #### Parameters

  - index: number

  #### Returns Node | Element | ChildNode

  - Defined in src/shared/noderef.js:191

### isElement

- isElement(): boolean

  #### Returns boolean

  - Defined in src/shared/noderef.js:224

### setIndex

- setIndex(index: number, node: Node | Element | ChildNode): void

  #### Parameters

  - index: number
  - node: Node | Element | ChildNode

  #### Returns void

  - Defined in src/shared/noderef.js:203