Inserts an element into the DOM given a reference element and the relative position of the new element.
where
{ after: reference }
reference
{ before: reference }
{ into: reference, at: 'start' }
{ into: reference }
The element(s) to insert.
An object specifying where to insert elem relative to another element.
elem
the element that was inserted, so you can do const a = insert(nu(), _).
const a = insert(nu(), _)
an Error when there are no valid keys ('into', 'after', or 'before') present in where.
Inserts an element into the DOM given a reference element and the relative position of the new element.
where
looks like{ after: reference }
, the element is inserted intoreference
's parent, afterreference
.where
looks like{ before: reference }
, the element is inserted intoreference
's parent, beforereference
.where
looks like{ into: reference, at: 'start' }
, the element is inserted intoreference
, before its first child.where
looks like{ into: reference }
, the element is inserted intoreference
, after its last child.