Gets the underlying DOM object.
Gets a wrapper around the Element's Shadow Root, if it exists.
A JJSR instance wrapping the shadow root, or null if no shadow root exists.
Appends children to this Element.
The children to append.
This instance for chaining.
Adds one or more classes to the Element.
The classes to add.
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.
Finds the closest ancestor (or self) that matches a CSS selector.
The CSS selector to search for.
A JJE wrapping the closest match, or null when none exists.
Disables the Element by setting the disabled attribute and aria-disabled="true".
This instance for chaining.
Removes all children from this Element.
This instance for chaining.
Enables the Element by removing the disabled and aria-disabled attributes.
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.
Gets the value of an ARIA attribute.
The ARIA attribute suffix (e.g., 'label' for 'aria-label').
The attribute value, or null if not present.
Gets the value of an attribute.
The name of the attribute.
The attribute value, or null if not present.
Gets the class attribute.
The class attribute value, or null if not present.
Gets a data attribute from the HTMLElement.
The data attribute name (in camelCase).
The value of the attribute, or undefined if not set.
Gets the inner HTML of the Element.
The inner HTML string.
Gets the text content of the SVGElement.
The text content.
Checks if an attribute exists.
The name of the attribute.
true if the attribute exists, otherwise false.
Checks if the Element has a specific class.
The class to check for.
true if the element has the class.
Checks if a data attribute exists on the HTMLElement.
The data attribute name (in camelCase).
True if the attribute exists, false otherwise.
Hides the Element by setting the hidden attribute and aria-hidden="true".
This instance for chaining.
Attaches a Shadow DOM to the Element and optionally sets its content and styles.
The encapsulation mode ('open' or 'closed'). Defaults to 'open'.
Optionalconfig: ShadowConfigOptional configuration object containing template (HTML string) and styles (array of CSSStyleSheet).
This instance for chaining.
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.
Removes one or more attributes from the Element.
The name(s) of the attribute(s) to remove.
This instance for chaining.
Removes one or more classes from the Element.
The classes to remove.
This instance for chaining.
Removes one or more data attributes from the HTMLElement.
The data attribute name(s) (in camelCase).
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.
Sets the class attribute or conditionally adds/removes classes.
setClass('')Sets the class attribute or conditionally adds/removes classes.
setClass('')Sets the inner HTML of the Element.
The HTML string to set, or null/undefined to clear.
Optionalunsafe: booleanexplicit opt-in to set innerHTML. must be true if html is provided.
This instance for chaining.
Sets the text content of the SVGElement.
Optionaltext: anyThe text to set, or null/undefined to clear.
This instance for chaining.
This method operates on textContent. The method name is kept short for convenience.
Pass an empty string, null, or undefined to clear the content.
Numbers and booleans are automatically converted to strings.
Shows the Element by removing the hidden and aria-hidden attributes.
This instance for chaining.
Toggles a class on the Element.
The class to toggle.
This instance for chaining.
Dispatches an Event at the specified EventTarget.
The Event object to dispatch.
This instance for chaining.
StaticcreateCreates a JJSE instance from a tag name (in the SVG namespace).
The tag name.
Optionaloptions: ElementCreationOptionsElement creation options.
A new JJSE instance.
StaticfromCreates a JJSE instance from an SVGElement reference.
The SVGElement.
A new JJSE instance.
StaticisChecks 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 DOM SVGElement.
Remarks
This class extends
JJEto provide specific functionality for SVG elements, including namespace-aware creation and helper methods for common SVG attributes.See
SVGElement