Releases: svileng/docrel
v1.4.3
v1.4.2
v1.4.1
v1.4.0
Element helpers for common HTML elements are now exported by docrel
, so instead of using the create
function to create the elements, you can now just do:
import {div, input, button} from "docrel"
before:
import {create} from "docrel"
const [div, input, button] = create("div", "input", "button")
The create
function is still available, so both of the examples above will work.
v1.3.0
You can now use the create
helper function to build createElement
functions, like so:
import {create} from "docrel"
let [div] = create("div")
The create
function accepts string arguments that correspond to HTML tag names, and returns an array of createElement
functions.
You can then use those functions to pass the remaining createElement
params, like options and children:
let wrapperDiv = div({class: "div-a"}, [div({class: "nested-div"})])
The createElement
function is used behind the scenes and is still available.
v1.2.0
Added id
and class
shorthand options to the createElement
constructor.
createElement("div", {id: "id", class: "foo bar"})
The class
shorthand sets element.className
to the given value:
https://developer.mozilla.org/en-US/docs/Web/API/Element/className