(Comment arg)
Mount a DOM Comment in current node
, containing stringified arg
. Return arg
.
Mount a DOM Comment in current `node`, containing stringified `arg`. Return `arg`.
(comment & args)
Mount a DOM Comment in current node
for each argument in args
.
Each Comment node will contain the stringified argument.
Return last argument as in do
.
Mount a DOM Comment in current `node` for each argument in `args`. Each Comment node will contain the stringified argument. Return last argument as in `do`.
(dd & body)
The <dd> HTML element provides the description, definition, or value for the preceding term (<dt>) in a description list (<dl>).
The <dd> HTML element provides the description, definition, or value for the preceding term (<dt>) in a description list (<dl>).
(dl & body)
The <dl> HTML element represents a description list. The element encloses a list of groups of terms (specified using the <dt> element) and descriptions (provided by <dd> elements). Common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs).
The <dl> HTML element represents a description list. The element encloses a list of groups of terms (specified using the <dt> element) and descriptions (provided by <dd> elements). Common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs).
(dt & body)
The <dt> HTML element specifies a term in a description or definition list, and as such must be used inside a <dl> element. It is usually followed by a <dd> element; however, multiple <dt> elements in a row indicate several terms that are all defined by the immediate next <dd> element.
The <dt> HTML element specifies a term in a description or definition list, and as such must be used inside a <dl> element. It is usually followed by a <dd> element; however, multiple <dt> elements in a row indicate several terms that are all defined by the immediate next <dd> element.
(element tag & body)
Mount a new DOM Element of type tag
in the current node
and run body
in
the context of the new Element.
(dom/element :div (dom/text "content"))
Mount a new DOM Element of type `tag` in the current `node` and run `body` in the context of the new Element. ```clj (dom/element :div (dom/text "content")) ```
(On event-type)
(On event-type f)
(On event-type f init-v)
(On event-type f init-v opts)
(On node event-type f init-v opts)
(OnAll event-type)
(OnAll event-type f)
(OnAll event-type f opts)
(OnAll event-type f opts concurrency-factor)
(OnAll node event-type f opts concurrency-factor)
(patch-nodelist element diff)
Take a DOM element
, an incseq's diff
and patch the diff over the element's
children list (a NodeList), applying additions, replacements, removals and reordering of
children. Must be called exactly once per element and exactly once per diff.
Take a DOM `element`, an incseq's `diff` and patch the diff over the element's children list (a NodeList), applying additions, replacements, removals and reordering of children. Must be called exactly once per element and exactly once per diff.
(perform-additions! element {:keys [degree grow permutation change]})
Take a DOM element
and an incseq's diff. Perform addition of new child elements into element
.
Take a DOM `element` and an incseq's diff. Perform addition of new child elements into `element`.
(perform-adds-and-replacements! element diff)
Take a DOM element
and an incseq's diff. Perform additions of new child elements and replacement of existing ones.
Replacement is not moving, replacement means replace existing children by new
children at the same, respective locations.
Take a DOM `element` and an incseq's diff. Perform additions of new child elements and replacement of existing ones. Replacement is not moving, replacement means replace existing children by new children at the same, respective locations.
(perform-removals! element {:keys [permutation degree shrink]})
Take a DOM element
and an incseq's diff. Must be called after perform-additions!
.
Will remove all deleted child elements from the element
's childlist.
Return the remaining permutations map to perform (reorders) after removals.
Take a DOM `element` and an incseq's diff. Must be called after `perform-additions!`. Will remove all deleted child elements from the `element`'s childlist. Return the remaining permutations map to perform (reorders) after removals.
(perform-removals-and-reorders! element diff)
Take a DOM element
and an incseq's diff. Perform removal of extra (deleted)
elements, and reordering of remaining elements. Must be called after
perform-adds-and-replacements!
.
Take a DOM `element` and an incseq's diff. Perform removal of extra (deleted) elements, and reordering of remaining elements. Must be called after `perform-adds-and-replacements!`.
(perform-reorders! element {:keys []} permutations)
Take a DOM element
, an incseq diff
and a map of permutations
describing
how to reorder child elements of element
, and perform reordering of those
child elements. permutations
must be the return value of perform-removals!
.
Take a DOM `element`, an incseq `diff` and a map of `permutations` describing how to reorder child elements of `element`, and perform reordering of those child elements. `permutations` must be the return value of `perform-removals!`.
(perform-replacements! element {:keys [permutation]} remaining-changes)
Take a DOM element
, an incseq's diff and a map of index -> value representing
the remaining changes after additions have been performed (return value of
perform-additions!
). For each change, will punch new values in, at their
respective indices, overwriting existing ones. Replacements are not reorders,
see perform-reorders!
.
Take a DOM `element`, an incseq's diff and a map of index -> value representing the remaining changes after additions have been performed (return value of `perform-additions!`). For each change, will punch new values in, at their respective indices, overwriting existing ones. Replacements are not reorders, see `perform-reorders!`.
(props attributes)
(props node attributes)
Take a map of HTML attributes to values and reactively sets each of them onto
a given DOM node
. Default node
is the one in scope.
Example:
(dom/div (dom/props {:id "my-div", :class ["foo"], :style {:background-color :red}}))
nil
will remove the attribute.node
's namespace (e.g. SVG vs HTML attributes):class
, setting the CSS class, can be a string or a collection of strings.:style
, setting inline CSS styles, supports setting CSS variables (e.g. {:--my-color :red})
Note props
will decide if an attribute is set as an HTML attribute or as a DOM
object property. For instance:
:value
is set through the node.value
property.:list
(input's datalist) can only be set by attribute, as the corresponding property is readonly.:class
doesn't set the "class" HTML attribute, but efficiently manipulates the node's .classList
property.:style
doesn't set the "style" HTML attribute, but efficiently manipulates the CSSStyleDeclaration object under the .style
property.Take a map of HTML attributes to values and reactively sets each of them onto a given DOM `node`. Default `node` is the one in scope. Example: ```clj (dom/div (dom/props {:id "my-div", :class ["foo"], :style {:background-color :red}})) ``` - A value of `nil` will remove the attribute. - Attribute names are case-insensitive, like in HTML. - Attribute inherits the `node`'s namespace (e.g. SVG vs HTML attributes) - `:class`, setting the CSS class, can be a string or a collection of strings. - `:style`, setting inline CSS styles, supports setting CSS variables (e.g. {:--my-color :red}) - for more complex styles (e.g. pseudo-classes, pseudo-elements, keyframes) use Electric-CSS. Note `props` will decide if an attribute is set as an HTML attribute or as a DOM object property. For instance: - An input's `:value` is set through the `node.value` property. - `:list` (input's datalist) can only be set by attribute, as the corresponding property is readonly. - `:class` doesn't set the "class" HTML attribute, but efficiently manipulates the node's `.classList` property. - `:style` doesn't set the "style" HTML attribute, but efficiently manipulates the CSSStyleDeclaration object under the `.style` property. - etc.
(text & args)
Mount a DOM TextNode in current node
for each argument in args
.
Each TextNode will contain the stringified argument.
Return last argument as in do
.
Mount a DOM TextNode in current `node` for each argument in `args`. Each TextNode will contain the stringified argument. Return last argument as in `do`.
(Text arg)
Mount a DOM TextNode in current node
, containing stringified arg
. Return arg
.
Mount a DOM TextNode in current `node`, containing stringified `arg`. Return `arg`.
(With element Body)
Run Body
in provided DOM element
, attaching and managing children inside it.
One would use With
instead of WithElement
to mount an Electric DOM UI inside
an existing DOM Element, typically libraries integration.
Run `Body` in provided DOM `element`, attaching and managing children inside it. One would use `With` instead of `WithElement` to mount an Electric DOM UI inside an existing DOM Element, typically libraries integration.
(WithElement tag Body)
(WithElement ns tag Body)
Mount a new DOM Element of type tag
in the current node
and run Body
in
the context of the new Element.
Mount a new DOM Element of type `tag` in the current `node` and run `Body` in the context of the new Element.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close