DOM overview
Added in v1.0.0
Table of contents
utils
addEventListener
Adds an event listener to node. See the MDN Reference for more details.
Signature
export declare const addEventListener: (
event: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions | undefined,
) => (node: Node) => IO.IO<void>;
Added in v1.0.0
appendChild
Signature
export declare const appendChild: (
child: Node,
) => (parent: Node) => IO.IO<Node>;
Added in v1.0.0
contains
Returns an IO of true if child is an inclusive descendant of parent, and an IO of false otherwise.
Signature
export declare const contains: (
child: Node,
) => (parent: Node) => IO.IO<boolean>;
Added in v1.0.0
createDocumentFragment
Creates a new document.
Signature
export declare function createDocumentFragment(): IO.IO<DocumentFragment>;
Added in v1.0.0
createElement
Creates an instance of the element for the specified tag.
Signature
export declare function createElement<K extends keyof HTMLElementTagNameMap>(
tagName: K,
options?: ElementCreationOptions,
): IO.IO<HTMLElementTagNameMap[K]>;
Added in v1.0.0
createTextNode
Creates a text string from the specified value.
Signature
export declare function createTextNode(data: string): IO.IO<Text>;
Added in v1.0.0
getElementById
Returns a reference to the first object with the specified value of the ID attribute within the document param.
Signature
export declare const getElementById: (
document: Document,
) => (id: string) => IOO.IOOption<HTMLElement>;
Added in v1.0.0
removeAttribute
Signature
export declare const removeAttribute: (
attribute: string,
) => (element: HTMLElement) => IO.IO<void>;
Added in v1.0.0
removeChild
Returns a IOO.none if child is not contained within parent. If it is contained, the child is removed from the within the parent and returned within an IOO.some.
Signature
export declare const removeChild: (
child: Node,
) => (parent: Node) => IOO.IOOption<Node>;
Added in v1.0.0
removeEventListener
Removes the event listener in node’s event listener list with the same type, callback, and options.
Signature
export declare const removeEventListener: (
event: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions | undefined,
) => (node: Node) => IO.IO<void>;
Added in v1.0.0
replaceChild
Returns a IOO.none if oldChild is not contained within parent. If it is contained, oldChild is replaced by newChild and returned within an IOO.some.
Signature
export declare const replaceChild: (
newChild: Node,
oldChild: Node,
) => (parent: Node) => IOO.IOOption<Node>;
Added in v1.0.0
setAttribute
Sets the value of element’s first attribute whose qualified name is attribute to value.
Signature
export declare const setAttribute: (
attribute: string,
value: string,
) => (element: HTMLElement) => IO.IO<void>;
Added in v1.0.0