hoplon.core
$text
($text str)
Given a string creates a text node
-->
Closing placeholder for <!-- to be used in html
<!--
Given a string creates a comment node
a
Creates an `a` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
abbr
Creates an `abbr` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
add-initfn!
(add-initfn! f)
address
Creates an `address` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
append-child!
(append-child! this child)
area
Creates an `area` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
article
Creates an `article` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
aside
Creates an `aside` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
attribute?
(attribute? this)
audio
Creates an `audio` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
b
Creates an `b` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
base
Creates an `base` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
bdi
Creates an `bdi` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
bdo
Creates an `bdo` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
blockquote
Creates an `blockquote` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
body
Creates a singleton `body` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
br
Creates an `br` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
bust-cache
(bust-cache path)
Public helper.
Experimental.
cache-key
macro
(cache-key)
cache-key
macro
(cache-key)
canvas
Creates an `canvas` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
caption
Creates an `caption` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
case-tpl
macro
(case-tpl expr & clauses)
Template. Accepts an `expr` cell and a number of `clauses` and returns a
cell with the value produced by the matching clause:
(case-tpl expr
:a (span "A")
:b (span "B")
(span "Default"))
case-tpl
macro
(case-tpl expr & clauses)
Template. Accepts an `expr` cell and a number of `clauses` and returns a
cell with the value produced by the matching clause:
(case-tpl expr
:a (span "A")
:b (span "B")
(span "Default"))
cite
Creates an `cite` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
code
Creates an `code` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
col
Creates an `col` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
colgroup
Creates an `colgroup` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
cond-tpl
macro
(cond-tpl & clauses)
Template. Accepts a number of `clauses` cell-template pairs and returns a
cell with the value produced by the matching clause:
(cond-tpl
clause-a (span "A")
clause-b (span "B")
:else (span "Default"))
cond-tpl
macro
(cond-tpl & clauses)
Template. Accepts a number of `clauses` cell-template pairs and returns a
cell with the value produced by the matching clause:
(cond-tpl
clause-a (span "A")
clause-b (span "B")
:else (span "Default"))
data
Creates an `data` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
datalist
Creates an `datalist` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
dd
Creates an `dd` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
def-values
macro
(def-values bindings values)
(def-values docstring bindings values)
Destructuring def, similar to scheme's define-values.
def-values
macro
(def-values bindings values)
(def-values docstring bindings values)
Destructuring def, similar to scheme's define-values.
defelem
macro
(defelem name & forms)
Defines an element function.
An element function creates a DOM Element (parent) given two arguments:
* `attrs` - a number of key-value pairs for attributes and their values
* `kids` - a sequence of DOM Elements to be appended/used inside
The returned DOM Element is itself a function which can accept more
attributes and child elements.
defelem
macro
(defelem name & forms)
Defines an element function.
An element function creates a DOM Element (parent) given two arguments:
* `attrs` - a number of key-value pairs for attributes and their values
* `kids` - a sequence of DOM Elements to be appended/used inside
The returned DOM Element is itself a function which can accept more
attributes and child elements.
defelem+
macro
(defelem+ name & forms)
Experimental.
Defines an extended element function.
An extended element function creates a DOM Element given two arguments:
* `attrs` - a number of key-value pairs for attributes and their values
* `kids` - a sequence of DOM Elements/Cells producing DOM Elements to be
appended/used inside
The returned DOM Element is itself a function which can accept more
attributes and child elements:
(defelem+ counter
[{:keys [state class]} kids]
(ul :class class, :click #(swap! state (fnil inc 0))
(loop-tpl :bingings [kid kids]
(li kid))
Differences to `defelem`:
- `kids` argument inside the `defelem+` is a Cell of DOM Elements
representing any DOM elements supplied during construction or
appended/removed at a later point in time.
- `attrs` argument must be destructured as it's also a Cell.
defelem+
macro
(defelem+ name & forms)
Experimental.
Defines an extended element function.
An extended element function creates a DOM Element given two arguments:
* `attrs` - a number of key-value pairs for attributes and their values
* `kids` - a sequence of DOM Elements/Cells producing DOM Elements to be
appended/used inside
The returned DOM Element is itself a function which can accept more
attributes and child elements:
(defelem+ counter
[{:keys [state class]} kids]
(ul :class class, :click #(swap! state (fnil inc 0))
(loop-tpl :bingings [kid kids]
(li kid))
Differences to `defelem`:
- `kids` argument inside the `defelem+` is a Cell of DOM Elements
representing any DOM elements supplied during construction or
appended/removed at a later point in time.
- `attrs` argument must be destructured as it's also a Cell.
definterval
macro
(definterval sym timeout & body)
definterval
macro
(definterval sym timeout & body)
del
Creates an `del` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
details
Creates an `details` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
dfn
Creates an `dfn` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
dialog
Creates an `dialog` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
div
Creates an `div` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
dl
Creates an `dl` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
do-watch
(do-watch ref f)
(do-watch ref init f)
Public helper.
Adds f as a watcher to ref and evaluates (f init @ref) once. The watcher
f is a function of two arguments: the previous and next values. If init is
not provided the default (nil) will be used.
dt
Creates an `dt` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
elem
macro
(elem bind & body)
Create an anonymous custom element.
elem
macro
(elem bind & body)
Create an anonymous custom element.
elem+
macro
(elem+ [bind-attr bind-kids] & body)
elem+
macro
(elem+ [bind-attr bind-kids] & body)
em
Creates an `em` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
embed
Creates an `embed` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
fieldset
Creates an `fieldset` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
figcaption
Creates an `figcaption` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
for-tpl
macro
(for-tpl [bindings items] body)
Template. Accepts a cell-binding and returns a cell containing a sequence of
elements:
(for-tpl [x xs] (span x))
for-tpl
macro
(for-tpl [bindings items] body)
Template. Accepts a cell-binding and returns a cell containing a sequence of
elements:
(for-tpl [x xs] (span x))
h1
Creates an `h1` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
h2
Creates an `h2` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
h3
Creates an `h3` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
h4
Creates an `h4` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
h5
Creates an `h5` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
h6
Creates an `h6` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
head
Creates a singleton `head` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
hgroup
Creates an `hgroup` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
hr
Creates an `hr` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
html-map
Creates an `map` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
html-object
Creates an `object` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
html-time
Creates an `time` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
html-var
Creates an `var` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
i
Creates an `i` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
ICustomAttribute
protocol
members
-attr!
(-attr! this elem value)
ICustomElement
protocol
members
-insert-before!
(-insert-before! this new existing)
-set-styles!
(-set-styles! this kvs)
-remove-child!
(-remove-child! this child)
-set-attributes!
(-set-attributes! this kvs)
-replace-child!
(-replace-child! this new existing)
-append-child!
(-append-child! this child)
if-tpl
macro
(if-tpl predicate consequent & [alternative])
Template. Accepts a `predicate` cell and returns a cell containing either
the element produced by `consequent` or `alternative`, depending on the value
of the predicate:
(if-tpl predicate (span "True") (span "False"))
if-tpl
macro
(if-tpl predicate consequent & [alternative])
Template. Accepts a `predicate` cell and returns a cell containing either
the element produced by `consequent` or `alternative`, depending on the value
of the predicate:
(if-tpl predicate (span "True") (span "False"))
iframe
Creates an `iframe` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
img
Creates an `img` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
ins
Creates an `ins` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
insert-before!
(insert-before! this new existing)
kbd
Creates an `kbd` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
keygen
Creates an `keygen` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
label
Creates an `label` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
legend
Creates an `legend` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
li
Creates an `li` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
link
Creates an `link` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
loop-tpl
macro
(loop-tpl & args)
Template. Works identically to `for-tpl`, only expects a `:bindings`
attribute to accomodate the HTML HLisp representation:
(loop-tpl :bindings [x xs] ...)
loop-tpl
macro
(loop-tpl & args)
Template. Works identically to `for-tpl`, only expects a `:bindings`
attribute to accomodate the HTML HLisp representation:
(loop-tpl :bindings [x xs] ...)
loop-tpl*
(loop-tpl* items tpl)
Given a cell items containing a seqable collection, constructs a cell that
works like a fill vector. The template tpl is a function of one argument: the
formula cell containing the ith item in items. The tpl function is called
once (and only once) for each index in items. When the items collection
shrinks the DOM element created by the template is not destroyed--it is only
removed from the DOM and cached. When the items collection grows again those
cached elements will be reinserted into the DOM at their original index.
main
Creates an `main` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
mark
Creates an `mark` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
meter
Creates an `meter` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
multicol
Creates an `multicol` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
nav
Creates an `nav` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
noframes
Creates an `noframes` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
normalize-class
(normalize-class kvs)
Public helper.
Class normalization for attribute providers.
noscript
Creates an `noscript` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
ol
Creates an `ol` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
on-page-load
(on-page-load f)
optgroup
Creates an `optgroup` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
option
Creates an `option` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
output
Creates an `output` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
p
Creates an `p` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
param
Creates an `param` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
picture
Creates an `picture` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
pre
Creates an `pre` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
prerendering?
Is the application running in a prerendering container (eg. PhantomJS via
the prerender task)?
progress
Creates an `progress` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
q
Creates an `q` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
remove-child!
(remove-child! this child)
replace-child!
(replace-child! this new existing)
route-cell
(route-cell & [default])
Defines a cell whose value is the URI fragment.
rp
Creates an `rp` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
rt
Creates an `rt` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
rtc
Creates an `rtc` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
ruby
Creates an `ruby` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
s
Creates an `s` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
safe-nth
(safe-nth coll index)
(safe-nth coll index not-found)
Like cljs.core/nth but returns nil or not found if the index is outside the coll
samp
Creates an `samp` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
script
Creates an `script` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
section
Creates an `section` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
select
Creates an `select` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
set-attributes!
(set-attributes! this kvs)
(set-attributes! this k v & kvs)
set-styles!
(set-styles! this kvs)
(set-styles! this k v & kvs)
shadow
Creates an `shadow` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
small
Creates an `small` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
source
Creates an `source` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
span
Creates an `span` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
strong
Creates an `strong` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
style
Creates an `style` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
sub
Creates an `sub` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
summary
Creates an `summary` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
sup
Creates an `sup` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
table
Creates an `table` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
tbody
Creates an `tbody` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
td
Creates an `td` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
template
Creates an `template` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
text
macro
(text form)
Creates a DOM Text node and binds its text content to a formula created via
string interpolation, so the Text node updates with the formula.
text
macro
(text form)
Creates a DOM Text node and binds its text content to a formula created via
string interpolation, so the Text node updates with the formula.
textarea
Creates an `textarea` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
th
Creates an `th` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
thead
Creates an `thead` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
timeout
(timeout f)
(timeout f t)
Executes a fuction after a delay, if no delay is passed, 0 is used as a default.
title
Creates an `title` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
tr
Creates an `tr` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
track
Creates an `track` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
u
Creates an `u` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
ul
Creates an `ul` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
video
Creates an `video` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
wbr
Creates an `wbr` element.
You can pass attributes as a map or keyword value pairs (but not both at the
same time) and children after the attributes.
when-dom
(when-dom this f)
when-tpl
macro
(when-tpl predicate & body)
Template. Accepts a `predicate` cell and returns a cell containing either
the element produced by `consequent` or nothing, depending on the value of
the predicate:
(when-tpl predicate (span "Value"))
when-tpl
macro
(when-tpl predicate & body)
Template. Accepts a `predicate` cell and returns a cell containing either
the element produced by `consequent` or nothing, depending on the value of
the predicate:
(when-tpl predicate (span "Value"))
with-dom
macro
(with-dom elem & body)
Evaluates the body after elem has been inserted into the DOM.
with-dom
macro
(with-dom elem & body)
Evaluates the body after elem has been inserted into the DOM.
with-init!
macro
(with-init! & body)
Evaluates the body after Hoplon has completed constructing the page.
with-init!
macro
(with-init! & body)
Evaluates the body after Hoplon has completed constructing the page.
with-interval
macro
(with-interval msec & body)
Evaluates the body every msec milliseconds, asynchronously. Returns the
interval ID which can be used to cancel the operation (see js/clearInterval).
with-interval
macro
(with-interval msec & body)
Evaluates the body every msec milliseconds, asynchronously. Returns the
interval ID which can be used to cancel the operation (see js/clearInterval).
with-page-load
macro
(with-page-load & body)
Evaluates the body when the page is reloaded OR when live-reload reloads.
with-page-load
macro
(with-page-load & body)
Evaluates the body when the page is reloaded OR when live-reload reloads.
with-timeout
macro
(with-timeout msec & body)
Evaluates the body after msec milliseconds, asynchronously. Returns the
timeout ID which can be used to cancel the operation (see js/clearTimeout).
with-timeout
macro
(with-timeout msec & body)
Evaluates the body after msec milliseconds, asynchronously. Returns the
timeout ID which can be used to cancel the operation (see js/clearTimeout).