-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - Adds CSS class to instance.
- Returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - Appends child element to instance
- Returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - Appends append instance as child element to node.
- Returns same instance.
- Applies to:
-
attr(key: string, value?: string , toggle?: boolean): String | HTMLElement | NodeList | HTMLModelArray
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - If
key
is only parameter, returns value of instance attribute with same key (does not apply toNodeList
andHTMLModelArray
). - If
value
is present, sets value to instance attribute with same key and returns same instance. - If
toggle
is present, toggles presence of attribute with same key and returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - If
property
is only parameter, returns value of instance css property (does not apply toNodeList
andHTMLModelArray
). - If
value
is present, sets instance css property to that value and returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - If
key
is only parameter, returns value of instance of data attribute (does not apply toNodeList
andHTMLModelArray
). - If
value
is present, sets instance css property to that value and returns same instance. - Note: setting value doesn't mutate the DOM, it caches value on element instance.
- Applies to:
-
- Applies to:
HTMLElement
andDocument
only. - Returns all element descendants of node that match selectors (executes instance.querySelector).
- If no matches found for selector - returns dummy parameter with result length property set to 0 (to avoid unnecessary nestings in code).
- Applies to:
-
- Applies to:
HTMLElement
andDocument
only. - Returns all element descendants of node that match selectors (executes instance.querySelectorAll).
- Applies to:
-
forEachChild(callback: (e?: HTMLElement)=>void=()=>{}, callFirst: boolean=false): HTMLElement | NodeList | HTMLModelArray
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - Iterates recursively trough child elements tree and execute
callback
for each element. callFirst
- if true, skips root, default is false.
- Applies to:
-
- Applies to:
HTMLElement
. - Check if element has class with className.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - Sets display to none and returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - Sets innerHTML value of element or elements and returns same instance.
- Applies to:
-
off(type: string, listener: EventListenerOrEventListenerObject): HTMLElement | NodeList | HTMLModelArray | Document | Window
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
,Document
,Window
. - Removes event listeners from element or elements (calls removeEventListener) and returns same instance.
- Applies to:
-
on(type: string, listener: EventListenerOrEventListenerObject): HTMLElement | NodeList | HTMLModelArray | Document | Window
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
,Document
,Window
. - Adds event listeners to element or elements (calls addEventListener) and returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
- Checks element overflown state horizontally.
- Applies to:
-
- Applies to:
HTMLElement
- Checks element overflown state vertically.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - Removes attribute by key and returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - Removes attribute by key and returns same instance.
- Applies to:
-
- Applies to: `HTMLElement
- Sets focus to element instance and returns same instance.
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - If state parameter is not present sets display css attribute to empty (inherit) and returns same instance.
- If state parameter not present toggles display css attribute none or empty and returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - Toggles class with className (adds or removes if present) and returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
,Document
,Window
. - Dispatches a synthetic event to target (calls dispatchEvent) and returns same instance.
- Applies to:
-
- Applies to:
HTMLElement
,NodeList
,HTMLModelArray
. - If state is not present, adds visibility: visible attribute, otherwise toggles between visible and hidden and returns same instance.
- Applies to:
-
- Returns hash code of string instance
-
- Gives lit-html support for Visual Studio Code lit-html extension
- Following string in JavaScript:
String.html`<div>some html</div>`
will have proper HTML language support with syntax highlight
-
- Builds HTMLElement from HTML markup in a string
-
- Converts kebab name in a string to camel cased name
-
- Creates element from tag name in a String and adds id and content if those params are present.