Elemento
GitHubSamples
  • Get started
  • Builder API
  • Event Handlers
  • Typesafe CSS Selectors
  • Custom Elements
  • Attach and Detach Handlers
  • Iterators / Iterables / Streams
  • Manipulate the DOM Tree
  • Router
  • Flow
  • Logger
  • SVG
  • MathML
  • Samples
Powered by GitBook
On this page
Edit on GitHub

Manipulate the DOM Tree

PreviousIterators / Iterables / StreamsNextRouter

Last updated 6 months ago

Elemento has static helpers methods in that help you to manipulate the DOM tree:

  • Elements.lazyAppend(Element parent, Element child) Appends child to parent. If parent already contains child, this method does nothing.

  • Elements.insertAfter(Element newElement, Element after) Inserts newElement into after's parent after after.

  • Elements.lazyInsertAfter(Element newElement, Element after) Inserts newElement into after's parent after after. If after's parent already contains newElement, this method does nothing.

  • Elements.insertBefore(Element newElement, Element before) Inserts newElement into before's parent before before.

  • Elements.lazyInsertBefore(Element new Element, Element before) Inserts newElement into before's parent before before. If before's parent already contains newElement, this method does nothing.

  • Elements.insertFirst(Element parent, Element newElement) Inserts newElement as the first element into parent.

  • Elements.removeChildrenFrom(Element element) Removes all child elements from element

  • Elements.failSafeRemove(Node parent, Element child) Removes child from parent.

  • Elements.failSafeRemoveFromParent(Element element) Removes element from its parent.

All methods are null-safe, check parent/child relationships, and are overloaded to accept an instance of IsElement<Element> instead of Element. See the API documentation of for more details.

Elements
Elements