Some useful tools for your DOM (and more)!
A function used for generating an element based on a string of HTML.
html: string
- The HTML string the element is based on.
The generated element.
In case you want to do routing on the client side, use this function to define a route and trigger a callback once the current pathname matches the route.
route: string
- Route the current pathname must match. E.g "/@/:username".callback: function (params: object)
- This callback will call whenever the current pathname matches the route. It will get 1 argument, which is all the params it matched. For example, if your route is "/@/:username" and the current pathname is "/@/realmy", the object will be{ "username": "realmy" }
.
true
A function used for adding styles to a CSS selector.
selector: string
- CSS selector of which elements these properties should apply to.styles: object
- Object of styles. Example:{ "font-family": "Arial, sans-serif", "color": "red" }
The generated CSS block.
A function used for adding styles to a specific element.
element: Element
- Element which these properties should apply to.styles: object
- Object of styles. Example:{ "font-family": "Arial, sans-serif", "color": "red" }
The generated CSS block.
Get an object of properties applied to this selector or element (only returns DT-generated styles).
selectorOrElement: string | element
- Selector or element of which styles must be returned.
The object of CSS properties applied to that selector/element (that has been generated by DT).