Gets the <body> element of the document wrapped in a JJHE instance.
The wrapped body element.
Gets the <head> element of the document wrapped in a JJHE instance.
The wrapped head element.
Gets the underlying DOM object.
Appends children to this Element.
The children to append.
This instance for chaining.
Creates a Text node from a string and appends it to this Node.
Optionaltext: string | nullThe text to add. If null or undefined, nothing is added.
This instance for chaining.
Clones the Node.
Optionaldeep: booleanIf true, clones the subtree.
A new wrapped instance of the clone.
Removes all children from this Element.
This instance for chaining.
Finds the first element matching a selector within this Element.
The CSS selector.
Whether to throw an error if not found. Defaults to false.
The wrapped element, or null if not found and required is false.
Finds all elements matching a selector within this Element.
The CSS selector.
An array of wrapped elements.
Removes an event listener.
The name of the event.
The event handler.
Optionaloptions: boolean | EventListenerOptionsOptional event listener options or boolean.
This instance for chaining.
Adds an event listener.
The name of the event.
The event handler.
Optionaloptions: AddEventListenerOptionsOptional event listener options.
This instance for chaining.
The handler is automatically bound to this JJET instance, so this inside the handler
refers to the JJET instance, not the DOM element. To access the DOM element, use this.ref.
Prepends children to this Element.
The children to prepend.
This instance for chaining.
Runs a function in the context of this JJET instance.
The return value of the function.
If you want to access the current JJ* instance using this keyword, you SHOULD use a function not an arrow function.
If the function throws, run() doesn't swallow the exception.
So if you're expecting an error, make sure to wrap it in a try..catch block and handle the exception.
If the function returns a promise, you can await on the response.
Replaces the existing children of an Element with a specified new set of children.
The children to replace with.
This instance for chaining.
Dispatches an Event at the specified EventTarget.
The Event object to dispatch.
This instance for chaining.
StaticfromStaticisChecks if a value can be passed to the wrap() or unwrap() function.
an unknown value
true if x is a string, Node (or its descendents), JJN (or its descendents)
StaticunwrapStaticunwrapStaticwrapWraps a native DOM node or string into the most specific JJ wrapper available.
The object to wrap. If it's already Wrapped, it'll be returned without any change. We don't double-wrap or clone it.
The most granular Wrapped subclass instance. If the input is already wrapped, it'll be returned as is without cloning.
Staticwrap
Wraps a Document (which is a descendant of Node).
Remarks
This class provides a wrapper around the native
Documentinterface, inheriting the fluent API capabilities ofJJN. It also supports querying (find) and manipulation (addChild,preChild) methods.To find elements by class name, use:
doc.find('.my-class')To set the document title, use:
doc.ref.title = 'New Title'Example
See
Document