Class BaseElement

  • Direct Known Subclasses:
    BaseHtmlElement

    @JsType(isNative=true,
            name="Element",
            namespace="<global>")
    public abstract class BaseElement
    extends BaseNode
    Base class from which all element objects (objects that represent elements) in a document inherit.
    It only has methods and properties common to all kinds of elements.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • getChildElementCount

        @JsProperty
        public final int getChildElementCount()
        Returns the number of children of this element which are elements.
        Returns:
        the number of children of this element which are elements
      • getClientHeight

        @JsProperty
        public final int getClientHeight()
        Returns a number representing the inner height of the element.
        Returns:
        a number representing the inner height of the element
      • getClientLeft

        @JsProperty
        public final int getClientLeft()
        Returns a number representing the width of the left border of the element.
        Returns:
        a number representing the width of the left border of the element
      • getClientTop

        @JsProperty
        public final int getClientTop()
        Returns a number representing the width of the top border of the element.
        Returns:
        a number representing the width of the top border of the element
      • getClientWidth

        @JsProperty
        public final int getClientWidth()
        Returns a number representing the inner width of the element.
        Returns:
        a number representing the inner width of the element
      • getFirstElementChild

        @JsProperty
        public final BaseElement getFirstElementChild()
        Returns the first node which is both a child of this element and is also an element, or null if there is none.
        Returns:
        the first node which is both a child of this element and is also an element, or null if there is none
      • getId

        @JsProperty
        public final String getId()
        Returns the unique id of the element.
        Returns:
        the unique id of the element
      • setId

        @JsProperty
        public final void setId​(String id)
        Sets the unique id of the element.
        Parameters:
        id - the unique id of the element
      • getInnerHTML

        @JsProperty
        public final String getInnerHTML()
        Returns the markup of the element's content.
        Returns:
        the markup of the element's content
      • setInnerHTML

        @JsProperty
        public final void setInnerHTML​(String innerHTML)
        Sets the markup of the element's content..
        Parameters:
        innerHTML - the markup of the element's content
      • getOuterHTML

        @JsProperty
        public final String getOuterHTML()
        Returns the serialized HTML fragment describing the element including its descendants.
        Returns:
        the serialized HTML fragment describing the element including its descendants
      • getLastElementChild

        @JsProperty
        public final BaseElement getLastElementChild()
        Returns the last node which is both a child of this element and is an element, or null if there is none.
        Returns:
        the last node which is both a child of this element and is an element, or null if there is none
      • getNextElementSibling

        @JsProperty
        public final BaseElement getNextElementSibling()
        Returns the element immediately following the given one in the tree, or null if there's no sibling node.
        Returns:
        the element immediately following the given one in the tree, or null if there's no sibling node
      • getPreviousElementSibling

        @JsProperty
        public final BaseElement getPreviousElementSibling()
        Returns the element immediately preceding the given one in the tree, or null if there is no sibling element.
        Returns:
        the element immediately preceding the given one in the tree, or null if there is no sibling element
      • getScrollHeight

        @JsProperty
        public final int getScrollHeight()
        Returns a number representing the scroll view height of an element.
        Returns:
        a number representing the scroll view height of an element
      • getScrollLeft

        @JsProperty
        public final double getScrollLeft()
        Returns a number representing the left scroll offset of the element.
        Returns:
        a number representing the left scroll offset of the element
      • getScrollTop

        @JsProperty
        public final double getScrollTop()
        Returns a number representing number of pixels the top of the document is scrolled vertically.
        Returns:
        a number representing number of pixels the top of the document is scrolled vertically
      • getScrollWidth

        @JsProperty
        public final int getScrollWidth()
        Returns a number representing the scroll view width of the element.
        Returns:
        a number representing the scroll view width of the element
      • getTagName

        @JsProperty
        public final String getTagName()
        Returns the name of the tag for the given element.
        Returns:
        the name of the tag for the given element
      • getAttributes

        @JsProperty
        public NamedNodeMap<BaseAttribute> getAttributes()
        Returns a collection of all attribute nodes registered to the specified node.
        Returns:
        a collection of all attribute nodes registered to the specified node
      • getElementsByTagName

        @JsMethod
        public final NodeList<BaseElement> getElementsByTagName​(String tagname)
        Returns a list containing all descendant elements, of a particular tag name, from the current element.
        Parameters:
        tagname - the qualified name to look for. The special string "*" represents all elements.
        Returns:
        a list containing all descendant elements
      • remove

        @JsMethod
        public final void remove()
        Removes the element from the children list of its parent.
      • hasAttributes

        @JsMethod
        public final boolean hasAttributes()
        Returns a boolean indicating whether the current element has any attributes or not.
        Returns:
        true whether the current element has any attributes
      • hasPointerCapture

        @JsMethod
        public final boolean hasPointerCapture​(int pointerId)
        Checks whether the element on which it is invoked has pointer capture for the pointer identified by the given pointer ID.
        Parameters:
        pointerId - pointer id, retrievable by NativePointerEvent.getId() or in PointerEventInit.getId()
        Returns:
        true whether the element on which it is invoked has pointer capture for the pointer identified by the given pointer ID
      • getBoundingClientRect

        @JsMethod
        public final DOMRectangle getBoundingClientRect()
        Returns a DOMRectangle object providing information about the size of an element and its position relative to the viewport.
        Returns:
        a DOMRectangle object providing information about the size of an element and its position relative to the viewport