DocumentFragment
charging?: boolean;
chargingTime?: number;
dischargingTime?: number;
level?: number;
ownerDocument: Document;
getElementById(elementId: string): null | HTMLElement;
addEventListener(
type: string,
callback: null | EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
dispatchEvent(event: Event): boolean;
removeEventListener(
type: string,
callback: null | EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
baseURI: string;
childNodes: NodeListOf<ChildNode>;
firstChild: null | ChildNode;
isConnected: boolean;
lastChild: null | ChildNode;
nextSibling: null | ChildNode;
nodeName: string;
nodeType: number;
nodeValue: null | string;
parentElement: null | HTMLElement;
parentNode: null | ParentNode;
previousSibling: null | ChildNode;
textContent: null | string;
appendChild<T extends Node>(node: T): T;
cloneNode(subtree?: boolean): Node;
compareDocumentPosition(other: Node): number;
contains(other: null | Node): boolean;
getRootNode(options?: GetRootNodeOptions): Node;
hasChildNodes(): boolean;
insertBefore<T extends Node>(node: T, child: null | Node): T;
isDefaultNamespace(namespace: null | string): boolean;
isEqualNode(otherNode: null | Node): boolean;
isSameNode(otherNode: null | Node): boolean;
lookupNamespaceURI(prefix: null | string): null | string;
lookupPrefix(namespace: null | string): null | string;
normalize(): void;
removeChild<T extends Node>(child: T): T;
replaceChild<T extends Node>(node: Node, child: T): T;
ELEMENT_NODE: 1;
ATTRIBUTE_NODE: 2;
TEXT_NODE: 3;
CDATA_SECTION_NODE: 4;
ENTITY_REFERENCE_NODE: 5;
ENTITY_NODE: 6;
PROCESSING_INSTRUCTION_NODE: 7;
COMMENT_NODE: 8;
DOCUMENT_NODE: 9;
DOCUMENT_TYPE_NODE: 10;
DOCUMENT_FRAGMENT_NODE: 11;
NOTATION_NODE: 12;
DOCUMENT_POSITION_DISCONNECTED: 1;
DOCUMENT_POSITION_PRECEDING: 2;
DOCUMENT_POSITION_FOLLOWING: 4;
DOCUMENT_POSITION_CONTAINS: 8;
DOCUMENT_POSITION_CONTAINED_BY: 16;
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
childElementCount: number;
children: HTMLCollection;
firstElementChild: null | Element;
lastElementChild: null | Element;
append(...nodes: (string | Node)[]): void;
prepend(...nodes: (string | Node)[]): void;
querySelector<K extends keyof HTMLElementTagNameMap>(
selectors: K,
): null | HTMLElementTagNameMap[K];
querySelector<K extends keyof SVGElementTagNameMap>(
selectors: K,
): null | SVGElementTagNameMap[K];
querySelector<K extends keyof MathMLElementTagNameMap>(
selectors: K,
): null | MathMLElementTagNameMap[K];
querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(
selectors: K,
): null | HTMLElementDeprecatedTagNameMap[K];
querySelector<E extends Element = Element>(selectors: string): null | E;
querySelectorAll<K extends keyof HTMLElementTagNameMap>(
selectors: K,
): NodeListOf<HTMLElementTagNameMap[K]>;
querySelectorAll<K extends keyof SVGElementTagNameMap>(
selectors: K,
): NodeListOf<SVGElementTagNameMap[K]>;
querySelectorAll<K extends keyof MathMLElementTagNameMap>(
selectors: K,
): NodeListOf<MathMLElementTagNameMap[K]>;
querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(
selectors: K,
): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
querySelectorAll<E extends Element = Element>(
selectors: string,
): NodeListOf<E>;
replaceChildren(...nodes: (string | Node)[]): void;
}
Hierarchy (View Summary)
- Node
- NonElementParentNode
- ParentNode
- DocumentFragment
Index
Properties
Methods
Properties
Optional
charging
Optional
charging Time
Optional
discharging Time
Optional
level
Readonly
owner Document
Returns the node document. Returns null for documents.
Readonly
base URI
Returns node's node document's document base URL.
Readonly
child Nodes
Returns the children.
Readonly
first Child
Returns the first child.
Readonly
is Connected
Returns true if node is connected and false otherwise.
Readonly
last Child
Returns the last child.
Readonly
next Sibling
Returns the next sibling.
Readonly
node Name
Returns a string appropriate for the type of node.
Readonly
node Type
Returns the type of node.
node Value
Readonly
parent Element
Returns the parent element.
Readonly
parent Node
Returns the parent.
Readonly
previous Sibling
Returns the previous sibling.
text Content
Readonly
ELEMENT_ NODE
node is an element.
Readonly
ATTRIBUTE_ NODE
Readonly
TEXT_ NODE
node is a Text node.
Readonly
CDATA_ SECTION_ NODE
node is a CDATASection node.
Readonly
ENTITY_ REFERENCE_ NODE
Readonly
ENTITY_ NODE
Readonly
PROCESSING_ INSTRUCTION_ NODE
node is a ProcessingInstruction node.
Readonly
COMMENT_ NODE
node is a Comment node.
Readonly
DOCUMENT_ NODE
node is a document.
Readonly
DOCUMENT_ TYPE_ NODE
node is a doctype.
Readonly
DOCUMENT_ FRAGMENT_ NODE
node is a DocumentFragment node.
Readonly
NOTATION_ NODE
Readonly
DOCUMENT_ POSITION_ DISCONNECTED
Set when node and other are not in the same tree.
Readonly
DOCUMENT_ POSITION_ PRECEDING
Set when other is preceding node.
Readonly
DOCUMENT_ POSITION_ FOLLOWING
Set when other is following node.
Readonly
DOCUMENT_ POSITION_ CONTAINS
Set when other is an ancestor of node.
Readonly
DOCUMENT_ POSITION_ CONTAINED_ BY
Set when other is a descendant of node.
Readonly
DOCUMENT_ POSITION_ IMPLEMENTATION_ SPECIFIC
Readonly
child Element Count
Readonly
children
Returns the child elements.
Readonly
first Element Child
Returns the first child that is an element, and null otherwise.
Readonly
last Element Child
Returns the last child that is an element, and null otherwise.
Methods
get Element By Id
getElementById(elementId: string): null | HTMLElement
Returns the first element within node's descendants whose ID is elementId.
Parameters
elementId: string
Returns null | HTMLElement
add Event Listener
addEventListener(
type: string,
callback: null | EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
Parameters
type: string
callback: null | EventListenerOrEventListenerObject
Optional
options: boolean | AddEventListenerOptions
Returns void
dispatch Event
remove Event Listener
removeEventListener(
type: string,
callback: null | EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void
Removes the event listener in target's event listener list with the same type, callback, and options.
Parameters
type: string
callback: null | EventListenerOrEventListenerObject
Optional
options: boolean | EventListenerOptions
Returns void
append Child
clone Node
compare Document Position
contains
get Root Node
getRootNode(options?: GetRootNodeOptions): Node
has Child Nodes
hasChildNodes(): boolean
Returns whether node has children.
Returns boolean
insert Before
is Default Namespace
isDefaultNamespace(namespace: null | string): boolean
is Equal Node
is Same Node
isSameNode(otherNode: null | Node): boolean
lookup Namespace URI
lookupNamespaceURI(prefix: null | string): null | string
lookup Prefix
lookupPrefix(namespace: null | string): null | string
normalize
normalize(): void
Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.
Returns void
remove Child
replace Child
append
prepend
query Selector
querySelector<K extends keyof HTMLElementTagNameMap>(
selectors: K,
): null | HTMLElementTagNameMap[K]
Returns the first element that is a descendant of node that matches selectors.
Type Parameters
- K extends keyof HTMLElementTagNameMap
Parameters
selectors: K
Returns null | HTMLElementTagNameMap[K]
querySelector<K extends keyof SVGElementTagNameMap>(
selectors: K,
): null | SVGElementTagNameMap[K]
Type Parameters
- K extends keyof SVGElementTagNameMap
Parameters
selectors: K
Returns null | SVGElementTagNameMap[K]
querySelector<K extends keyof MathMLElementTagNameMap>(
selectors: K,
): null | MathMLElementTagNameMap[K]
Type Parameters
- K extends keyof MathMLElementTagNameMap
Parameters
selectors: K
Returns null | MathMLElementTagNameMap[K]
querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(
selectors: K,
): null | HTMLElementDeprecatedTagNameMap[K]
Type Parameters
- K extends keyof HTMLElementDeprecatedTagNameMap
Parameters
selectors: K
Returns null | HTMLElementDeprecatedTagNameMap[K]
query Selector All
querySelectorAll<K extends keyof HTMLElementTagNameMap>(
selectors: K,
): NodeListOf<HTMLElementTagNameMap[K]>
Returns all element descendants of node that match selectors.
Type Parameters
- K extends keyof HTMLElementTagNameMap
Parameters
selectors: K
Returns NodeListOf<HTMLElementTagNameMap[K]>
querySelectorAll<K extends keyof SVGElementTagNameMap>(
selectors: K,
): NodeListOf<SVGElementTagNameMap[K]>
Type Parameters
- K extends keyof SVGElementTagNameMap
Parameters
selectors: K
Returns NodeListOf<SVGElementTagNameMap[K]>
querySelectorAll<K extends keyof MathMLElementTagNameMap>(
selectors: K,
): NodeListOf<MathMLElementTagNameMap[K]>
Type Parameters
- K extends keyof MathMLElementTagNameMap
Parameters
selectors: K
Returns NodeListOf<MathMLElementTagNameMap[K]>
querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(
selectors: K,
): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>
Type Parameters
- K extends keyof HTMLElementDeprecatedTagNameMap
Parameters
selectors: K
A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made.
MDN Reference