utils/dom
- utils/dom
- .dataAttributeToDatasetKey(dataAttribute) ⇒
string - .getVisualRows(parent) ⇒
Array.<Array.<HTMLElement>> - .setPositionClasses(parent, classes)
- .resolveClasses(input) ⇒
Array.<string>
- .dataAttributeToDatasetKey(dataAttribute) ⇒
utils/dom.dataAttributeToDatasetKey(dataAttribute) ⇒ string
Converts a data attribute name to its corresponding dataset property name.
Kind: static method of utils/dom
Returns: string - - The dataset property name (e.g., "uluDialog").
| Param | Type | Description |
|---|---|---|
| dataAttribute | string |
The data attribute name (e.g., "data-ulu-dialog"). |
utils/dom.getVisualRows(parent) ⇒ Array.<Array.<HTMLElement>>
Groups a parent's children into rows based on their visual coordinates (top and left positions). Filters out hidden elements and sorts them visually to support CSS grid order properties.
Kind: static method of utils/dom
Returns: Array.<Array.<HTMLElement>> - A 2D array of rows, where each row is an array of elements in visual order.
| Param | Type | Description |
|---|---|---|
| parent | HTMLElement |
The grid/parent container |
utils/dom.setPositionClasses(parent, classes)
Sets up the positional classes that would come from the equal height module. Needs to be rerun by user when layout changes or new instances are added to the screen
- Used for gutter crops
- Used for rule placement
- Devs Remember that default classes should match sass defaults
Kind: static method of utils/dom
| Param | Type | Description |
|---|---|---|
| parent | Node |
The grid parent <data-grid=""> |
| classes | Object |
Override the default equal heights classes |
utils/dom.resolveClasses(input) ⇒ Array.<string>
Resolves a class input (string or array) into a consistent array of class names.
Kind: static method of utils/dom
Returns: Array.<string> - An array of class names. Returns an empty array for invalid or falsy input.
| Param | Type | Description |
|---|---|---|
| input | string | Array.<string> |
The class input, which can be a string, an array of strings, or any other value. |
Example
resolveClassArray("fas fa-check my-class"); // Returns ["fas", "fa-check", "my-class"]
resolveClassArray(["another-class", "yet-another-class"]); // Returns ["another-class", "yet-another-class"]
resolveClassArray("single-class"); // Returns ["single-class"]