Class ElementUtil


  • public class ElementUtil
    extends Object
    Utils class, intended to ease working with DOM elements on client side.
    Author:
    Vaadin Ltd
    • Method Detail

      • hasTag

        public static boolean hasTag​(elemental.dom.Node node,
                                     String tag)
        Checks whether the node has required tag.
        Parameters:
        node - the node to check
        tag - the required tag name
        Returns:
        true if the node has required tag name
      • getElementById

        public static elemental.dom.Element getElementById​(elemental.dom.Node context,
                                                           String id)
        Searches the shadow root of the given context element for the given id or searches the light DOM if the element has no shadow root.
        Parameters:
        context - the container element to search through
        id - the identifier of the element to search for
        Returns:
        the element with the given id if found, otherwise null