Menu
pushmode.elements

Class AnyHtmlElement

PushMode » API Reference » pushmode.elements

    • Constructor Detail

      • AnyHtmlElement

        @InternalPushModeApi
        protected AnyHtmlElement()
        Creates new empty element. Applications never call this method directly. PushMode provides derived classes for all standard elements.
      • AnyHtmlElement

        @InternalPushModeApi
        protected AnyHtmlElement(AnyHtmlElement other)
        Creates deep mutable copy of another element. Applications never call this method directly. Method clone() should be used to create deep mutable clones.
        Parameters:
        other - Element to clone.
        Throws:
        NullPointerException - The parameter is null.
    • Method Detail

      • clone

        public abstract AnyHtmlElement clone()
        Description copied from class: DomElement
        Creates mutable deep clone of this element. All child nodes are cloned recursively. The clone is completely independent of this element.
        Specified by:
        clone in class DomElement
        Returns:
        Deep mutable clone.
      • accesskey

        public AnyHtmlElement accesskey(String value)
        Sets accesskey attribute on this element.
        Parameters:
        value - New value of accesskey attribute. This method has no effect if it is null.
        Returns:
        this
      • contenteditable

        public AnyHtmlElement contenteditable(String value)
        Sets contenteditable attribute on this element.
        Parameters:
        value - New value of contenteditable attribute. This method has no effect if it is null.
        Returns:
        this
      • contextmenu

        public AnyHtmlElement contextmenu(String value)
        Sets contextmenu attribute on this element.
        Parameters:
        value - New value of contextmenu attribute. This method has no effect if it is null.
        Returns:
        this
      • dir

        public AnyHtmlElement dir(String value)
        Sets dir attribute on this element.
        Parameters:
        value - New value of dir attribute. This method has no effect if it is null.
        Returns:
        this
      • draggable

        public AnyHtmlElement draggable(String value)
        Sets draggable attribute on this element.
        Parameters:
        value - New value of draggable attribute. This method has no effect if it is null.
        Returns:
        this
      • dropzone

        public AnyHtmlElement dropzone(String value)
        Sets dropzone attribute on this element.
        Parameters:
        value - New value of dropzone attribute. This method has no effect if it is null.
        Returns:
        this
      • hidden

        public AnyHtmlElement hidden()
        Adds hidden attribute to this element. Boolean attribute hidden is serialized as <... hidden ...>, i.e. without value. This method has no effect if the attribute is already present.
        Returns:
        this
      • hidden

        public AnyHtmlElement hidden(boolean value)
        Adds hidden attribute to this element. Boolean attribute hidden is serialized as <... hidden ...>, i.e. without value. This method has no effect if the parameter is false or the attribute is already present.
        Parameters:
        value - If true, the attribute is added. If false, this method has no effect.
        Returns:
        this
      • hidden

        public AnyHtmlElement hidden(Boolean value)
        Adds hidden attribute to this element. Boolean attribute hidden is serialized as <... hidden ...>, i.e. without value. This method has no effect if the parameter is false or null or if the attribute is already present.
        Parameters:
        value - If true, the attribute is added. If false or null, this method has no effect.
        Returns:
        this
      • lang

        public AnyHtmlElement lang(String value)
        Sets lang attribute on this element.
        Parameters:
        value - New value of lang attribute. This method has no effect if it is null.
        Returns:
        this
      • role

        public AnyHtmlElement role(String value)
        Sets role attribute on this element.
        Parameters:
        value - New value of role attribute. This method has no effect if it is null.
        Returns:
        this
      • spellcheck

        public AnyHtmlElement spellcheck(String value)
        Sets spellcheck attribute on this element.
        Parameters:
        value - New value of spellcheck attribute. This method has no effect if it is null.
        Returns:
        this
      • tabindex

        public AnyHtmlElement tabindex(String value)
        Sets tabindex attribute on this element.
        Parameters:
        value - New value of tabindex attribute. This method has no effect if it is null.
        Returns:
        this
      • title

        public AnyHtmlElement title(String value)
        Sets title attribute on this element.
        Parameters:
        value - New value of title attribute. This method has no effect if it is null.
        Returns:
        this
      • translate

        public AnyHtmlElement translate(String value)
        Sets translate attribute on this element.
        Parameters:
        value - New value of translate attribute. This method has no effect if it is null.
        Returns:
        this
      • onabort

        public AnyHtmlElement onabort(String value)
        Sets onabort attribute on this element.
        Parameters:
        value - New value of onabort attribute. This method has no effect if it is null.
        Returns:
        this
      • onautocomplete

        public AnyHtmlElement onautocomplete(String value)
        Sets onautocomplete attribute on this element.
        Parameters:
        value - New value of onautocomplete attribute. This method has no effect if it is null.
        Returns:
        this
      • onautocompleteerror

        public AnyHtmlElement onautocompleteerror(String value)
        Sets onautocompleteerror attribute on this element.
        Parameters:
        value - New value of onautocompleteerror attribute. This method has no effect if it is null.
        Returns:
        this
      • onblur

        public AnyHtmlElement onblur(String value)
        Sets onblur attribute on this element.
        Parameters:
        value - New value of onblur attribute. This method has no effect if it is null.
        Returns:
        this
      • oncancel

        public AnyHtmlElement oncancel(String value)
        Sets oncancel attribute on this element.
        Parameters:
        value - New value of oncancel attribute. This method has no effect if it is null.
        Returns:
        this
      • oncanplay

        public AnyHtmlElement oncanplay(String value)
        Sets oncanplay attribute on this element.
        Parameters:
        value - New value of oncanplay attribute. This method has no effect if it is null.
        Returns:
        this
      • oncanplaythrough

        public AnyHtmlElement oncanplaythrough(String value)
        Sets oncanplaythrough attribute on this element.
        Parameters:
        value - New value of oncanplaythrough attribute. This method has no effect if it is null.
        Returns:
        this
      • onchange

        public AnyHtmlElement onchange(String value)
        Sets onchange attribute on this element.
        Parameters:
        value - New value of onchange attribute. This method has no effect if it is null.
        Returns:
        this
      • onclick

        public AnyHtmlElement onclick(String value)
        Sets onclick attribute on this element.
        Parameters:
        value - New value of onclick attribute. This method has no effect if it is null.
        Returns:
        this
      • onclose

        public AnyHtmlElement onclose(String value)
        Sets onclose attribute on this element.
        Parameters:
        value - New value of onclose attribute. This method has no effect if it is null.
        Returns:
        this
      • oncontextmenu

        public AnyHtmlElement oncontextmenu(String value)
        Sets oncontextmenu attribute on this element.
        Parameters:
        value - New value of oncontextmenu attribute. This method has no effect if it is null.
        Returns:
        this
      • oncuechange

        public AnyHtmlElement oncuechange(String value)
        Sets oncuechange attribute on this element.
        Parameters:
        value - New value of oncuechange attribute. This method has no effect if it is null.
        Returns:
        this
      • ondblclick

        public AnyHtmlElement ondblclick(String value)
        Sets ondblclick attribute on this element.
        Parameters:
        value - New value of ondblclick attribute. This method has no effect if it is null.
        Returns:
        this
      • ondrag

        public AnyHtmlElement ondrag(String value)
        Sets ondrag attribute on this element.
        Parameters:
        value - New value of ondrag attribute. This method has no effect if it is null.
        Returns:
        this
      • ondragend

        public AnyHtmlElement ondragend(String value)
        Sets ondragend attribute on this element.
        Parameters:
        value - New value of ondragend attribute. This method has no effect if it is null.
        Returns:
        this
      • ondragenter

        public AnyHtmlElement ondragenter(String value)
        Sets ondragenter attribute on this element.
        Parameters:
        value - New value of ondragenter attribute. This method has no effect if it is null.
        Returns:
        this
      • ondragexit

        public AnyHtmlElement ondragexit(String value)
        Sets ondragexit attribute on this element.
        Parameters:
        value - New value of ondragexit attribute. This method has no effect if it is null.
        Returns:
        this
      • ondragleave

        public AnyHtmlElement ondragleave(String value)
        Sets ondragleave attribute on this element.
        Parameters:
        value - New value of ondragleave attribute. This method has no effect if it is null.
        Returns:
        this
      • ondragover

        public AnyHtmlElement ondragover(String value)
        Sets ondragover attribute on this element.
        Parameters:
        value - New value of ondragover attribute. This method has no effect if it is null.
        Returns:
        this
      • ondragstart

        public AnyHtmlElement ondragstart(String value)
        Sets ondragstart attribute on this element.
        Parameters:
        value - New value of ondragstart attribute. This method has no effect if it is null.
        Returns:
        this
      • ondrop

        public AnyHtmlElement ondrop(String value)
        Sets ondrop attribute on this element.
        Parameters:
        value - New value of ondrop attribute. This method has no effect if it is null.
        Returns:
        this
      • ondurationchange

        public AnyHtmlElement ondurationchange(String value)
        Sets ondurationchange attribute on this element.
        Parameters:
        value - New value of ondurationchange attribute. This method has no effect if it is null.
        Returns:
        this
      • onemptied

        public AnyHtmlElement onemptied(String value)
        Sets onemptied attribute on this element.
        Parameters:
        value - New value of onemptied attribute. This method has no effect if it is null.
        Returns:
        this
      • onended

        public AnyHtmlElement onended(String value)
        Sets onended attribute on this element.
        Parameters:
        value - New value of onended attribute. This method has no effect if it is null.
        Returns:
        this
      • onerror

        public AnyHtmlElement onerror(String value)
        Sets onerror attribute on this element.
        Parameters:
        value - New value of onerror attribute. This method has no effect if it is null.
        Returns:
        this
      • onfocus

        public AnyHtmlElement onfocus(String value)
        Sets onfocus attribute on this element.
        Parameters:
        value - New value of onfocus attribute. This method has no effect if it is null.
        Returns:
        this
      • oninput

        public AnyHtmlElement oninput(String value)
        Sets oninput attribute on this element.
        Parameters:
        value - New value of oninput attribute. This method has no effect if it is null.
        Returns:
        this
      • oninvalid

        public AnyHtmlElement oninvalid(String value)
        Sets oninvalid attribute on this element.
        Parameters:
        value - New value of oninvalid attribute. This method has no effect if it is null.
        Returns:
        this
      • onkeydown

        public AnyHtmlElement onkeydown(String value)
        Sets onkeydown attribute on this element.
        Parameters:
        value - New value of onkeydown attribute. This method has no effect if it is null.
        Returns:
        this
      • onkeypress

        public AnyHtmlElement onkeypress(String value)
        Sets onkeypress attribute on this element.
        Parameters:
        value - New value of onkeypress attribute. This method has no effect if it is null.
        Returns:
        this
      • onkeyup

        public AnyHtmlElement onkeyup(String value)
        Sets onkeyup attribute on this element.
        Parameters:
        value - New value of onkeyup attribute. This method has no effect if it is null.
        Returns:
        this
      • onload

        public AnyHtmlElement onload(String value)
        Sets onload attribute on this element.
        Parameters:
        value - New value of onload attribute. This method has no effect if it is null.
        Returns:
        this
      • onloadeddata

        public AnyHtmlElement onloadeddata(String value)
        Sets onloadeddata attribute on this element.
        Parameters:
        value - New value of onloadeddata attribute. This method has no effect if it is null.
        Returns:
        this
      • onloadedmetadata

        public AnyHtmlElement onloadedmetadata(String value)
        Sets onloadedmetadata attribute on this element.
        Parameters:
        value - New value of onloadedmetadata attribute. This method has no effect if it is null.
        Returns:
        this
      • onloadstart

        public AnyHtmlElement onloadstart(String value)
        Sets onloadstart attribute on this element.
        Parameters:
        value - New value of onloadstart attribute. This method has no effect if it is null.
        Returns:
        this
      • onmousedown

        public AnyHtmlElement onmousedown(String value)
        Sets onmousedown attribute on this element.
        Parameters:
        value - New value of onmousedown attribute. This method has no effect if it is null.
        Returns:
        this
      • onmouseenter

        public AnyHtmlElement onmouseenter(String value)
        Sets onmouseenter attribute on this element.
        Parameters:
        value - New value of onmouseenter attribute. This method has no effect if it is null.
        Returns:
        this
      • onmouseleave

        public AnyHtmlElement onmouseleave(String value)
        Sets onmouseleave attribute on this element.
        Parameters:
        value - New value of onmouseleave attribute. This method has no effect if it is null.
        Returns:
        this
      • onmousemove

        public AnyHtmlElement onmousemove(String value)
        Sets onmousemove attribute on this element.
        Parameters:
        value - New value of onmousemove attribute. This method has no effect if it is null.
        Returns:
        this
      • onmouseout

        public AnyHtmlElement onmouseout(String value)
        Sets onmouseout attribute on this element.
        Parameters:
        value - New value of onmouseout attribute. This method has no effect if it is null.
        Returns:
        this
      • onmouseover

        public AnyHtmlElement onmouseover(String value)
        Sets onmouseover attribute on this element.
        Parameters:
        value - New value of onmouseover attribute. This method has no effect if it is null.
        Returns:
        this
      • onmouseup

        public AnyHtmlElement onmouseup(String value)
        Sets onmouseup attribute on this element.
        Parameters:
        value - New value of onmouseup attribute. This method has no effect if it is null.
        Returns:
        this
      • onmousewheel

        public AnyHtmlElement onmousewheel(String value)
        Sets onmousewheel attribute on this element.
        Parameters:
        value - New value of onmousewheel attribute. This method has no effect if it is null.
        Returns:
        this
      • onpause

        public AnyHtmlElement onpause(String value)
        Sets onpause attribute on this element.
        Parameters:
        value - New value of onpause attribute. This method has no effect if it is null.
        Returns:
        this
      • onplay

        public AnyHtmlElement onplay(String value)
        Sets onplay attribute on this element.
        Parameters:
        value - New value of onplay attribute. This method has no effect if it is null.
        Returns:
        this
      • onplaying

        public AnyHtmlElement onplaying(String value)
        Sets onplaying attribute on this element.
        Parameters:
        value - New value of onplaying attribute. This method has no effect if it is null.
        Returns:
        this
      • onprogress

        public AnyHtmlElement onprogress(String value)
        Sets onprogress attribute on this element.
        Parameters:
        value - New value of onprogress attribute. This method has no effect if it is null.
        Returns:
        this
      • onratechange

        public AnyHtmlElement onratechange(String value)
        Sets onratechange attribute on this element.
        Parameters:
        value - New value of onratechange attribute. This method has no effect if it is null.
        Returns:
        this
      • onreset

        public AnyHtmlElement onreset(String value)
        Sets onreset attribute on this element.
        Parameters:
        value - New value of onreset attribute. This method has no effect if it is null.
        Returns:
        this
      • onresize

        public AnyHtmlElement onresize(String value)
        Sets onresize attribute on this element.
        Parameters:
        value - New value of onresize attribute. This method has no effect if it is null.
        Returns:
        this
      • onscroll

        public AnyHtmlElement onscroll(String value)
        Sets onscroll attribute on this element.
        Parameters:
        value - New value of onscroll attribute. This method has no effect if it is null.
        Returns:
        this
      • onseeked

        public AnyHtmlElement onseeked(String value)
        Sets onseeked attribute on this element.
        Parameters:
        value - New value of onseeked attribute. This method has no effect if it is null.
        Returns:
        this
      • onseeking

        public AnyHtmlElement onseeking(String value)
        Sets onseeking attribute on this element.
        Parameters:
        value - New value of onseeking attribute. This method has no effect if it is null.
        Returns:
        this
      • onselect

        public AnyHtmlElement onselect(String value)
        Sets onselect attribute on this element.
        Parameters:
        value - New value of onselect attribute. This method has no effect if it is null.
        Returns:
        this
      • onshow

        public AnyHtmlElement onshow(String value)
        Sets onshow attribute on this element.
        Parameters:
        value - New value of onshow attribute. This method has no effect if it is null.
        Returns:
        this
      • onsort

        public AnyHtmlElement onsort(String value)
        Sets onsort attribute on this element.
        Parameters:
        value - New value of onsort attribute. This method has no effect if it is null.
        Returns:
        this
      • onstalled

        public AnyHtmlElement onstalled(String value)
        Sets onstalled attribute on this element.
        Parameters:
        value - New value of onstalled attribute. This method has no effect if it is null.
        Returns:
        this
      • onsubmit

        public AnyHtmlElement onsubmit(String value)
        Sets onsubmit attribute on this element.
        Parameters:
        value - New value of onsubmit attribute. This method has no effect if it is null.
        Returns:
        this
      • onsuspend

        public AnyHtmlElement onsuspend(String value)
        Sets onsuspend attribute on this element.
        Parameters:
        value - New value of onsuspend attribute. This method has no effect if it is null.
        Returns:
        this
      • ontimeupdate

        public AnyHtmlElement ontimeupdate(String value)
        Sets ontimeupdate attribute on this element.
        Parameters:
        value - New value of ontimeupdate attribute. This method has no effect if it is null.
        Returns:
        this
      • ontoggle

        public AnyHtmlElement ontoggle(String value)
        Sets ontoggle attribute on this element.
        Parameters:
        value - New value of ontoggle attribute. This method has no effect if it is null.
        Returns:
        this
      • onvolumechange

        public AnyHtmlElement onvolumechange(String value)
        Sets onvolumechange attribute on this element.
        Parameters:
        value - New value of onvolumechange attribute. This method has no effect if it is null.
        Returns:
        this
      • onwaiting

        public AnyHtmlElement onwaiting(String value)
        Sets onwaiting attribute on this element.
        Parameters:
        value - New value of onwaiting attribute. This method has no effect if it is null.
        Returns:
        this
      • onclick

        public AnyHtmlElement onclick(Runnable handler)
        Adds event handler for click event. Single event can have multiple event handlers. This method adds new event handler to the end of the list. Event handlers are executed in order.
        Parameters:
        handler - Event handler to add. If null, an empty event handler is added.
        Returns:
        this
      • onchange

        public AnyHtmlElement onchange(Runnable handler)
        Adds event handler for change event. Single event can have multiple event handlers. This method adds new event handler to the end of the list. Event handlers are executed in order.
        Parameters:
        handler - Event handler to add. If null, an empty event handler is added.
        Returns:
        this
      • oninput

        public AnyHtmlElement oninput(Runnable handler)
        Adds event handler for input event. Single event can have multiple event handlers. This method adds new event handler to the end of the list. Event handlers are executed in order.
        Parameters:
        handler - Event handler to add. If null, an empty event handler is added.
        Returns:
        this
      • key

        public AnyHtmlElement key(Object key)
        Description copied from class: DomElement
        Sets element's pairing key. Any object implementing Object.equals(Object) and Object.hashCode() can be used as a key. Key, if set, must be unique among siblings in the DOM tree. Once set, the key is available from DomElement.key(). If the key is set to null, DomElement.key() will return DomElement.id().
        While DomElement.id() is sent to the browser, is a String, and it should be unique in the document, DomElement.key() is used only server-side, can be of any type, and it only needs to be unique among sibling elements.
        Key is used in hierarchical DOM diff to pair corresponding elements in cases where some DOM nodes have been inserted or removed from parent's child list. If DomElement.key() is null, DOM diff uses element position to pair elements in compared DOM trees, which might result in unnecessarily big diffs if an element is inserted at the beginning of a long list. Absence of key thus doesn't impact functionality, only performance. And even then it matters only if siblings are inserted or removed.
        Overrides:
        key in class DomElement
        Parameters:
        key - New element key. Any object implementing Object.equals(Object) and Object.hashCode() can be used as a key. Key, if set, must be unique among siblings in the DOM tree. If this parameter is null, DomElement.key() will return DomElement.id().
        Returns:
        this
      • id

        public AnyHtmlElement id(String id)
        Description copied from class: DomElement
        Sets element's ID. Element ID is serialized as an id attribute in HTML. It must therefore fulfill criteria for proper element ID in HTML, which most importantly means the ID should be unique in the document. Element ID has a special meaning in PushMode. Listeners require the element to have an ID. Listeners on ID-less elements are ignored. Once set, the ID is available from DomElement.id() method. ID is the default value of DomElement.key().
        Overrides:
        id in class DomElement
        Parameters:
        id - New element ID.
        Returns:
        this
      • clazz

        public AnyHtmlElement clazz(String clazz)
        Description copied from class: DomElement
        Sets class attribute. If the attribute is already set, this method appends new value to the old value separated by space.
        Overrides:
        clazz in class DomElement
        Parameters:
        clazz - Text to set/append to the class attribute. This method has no effect if the parameter is null.
        Returns:
        this
      • data

        public AnyHtmlElement data(String key,
                                   String value)
        Description copied from class: DomElement
        Sets data-* attribute.
        Overrides:
        data in class DomElement
        Parameters:
        key - Name of the attribute if formed from its key and 'data-' prefix, e.g. key hello will set attribute data-hello. This method has no effect if the parameter is null.
        value - Text to write to the data-[key] attribute. This method has no effect if the parameter is null.
        Returns:
        this
      • style

        public AnyHtmlElement style(String style)
        Description copied from class: DomElement
        Sets style attribute. If the attribute is already set, this method appends new value to the old value separated by semicolon.
        Overrides:
        style in class DomElement
        Parameters:
        style - Text to set/append to the style attribute. This method has no effect if the parameter is null.
        Returns:
        this
      • add

        public <C extends DomContentAnyHtmlElement add(C... children)
        Description copied from class: DomElement
        Adds all nodes in an array to this element.
        Overrides:
        add in class DomElement
        Parameters:
        children - Array of child nodes to add. This method has no effect if the parameter is null. Array items that are null are skipped.
        Returns:
        this
        See Also:
        DomElement.add(DomContent)
      • text

        public AnyHtmlElement text(String text)
        Description copied from class: DomElement
        Adds literal text to this element The text is first wrapped in DomText. If the text is null or empty, this method has no effect.
        Overrides:
        text in class DomElement
        Parameters:
        text - Text to add. This method has no effect if the text is null or empty.
        Returns:
        this
        See Also:
        DomElement.add(DomContent)
      • freeze

        public AnyHtmlElement freeze()
        Description copied from class: DomElement
        Creates frozen deep clone of this element. Mutating methods throw IllegalStateException when executed on frozen element. Frozen elements can be safely shared by all threads. Freezing is recursive. Frozen elements therefore cannot contain mutable nodes.
        Freezing applies several transformations to the cloned element, so that these transformations don't have to be performed repeatedly during rendering. All DomFragment descendants are recursively inlined into their respective parents, so that the frozen element contains no DomFragment descendants. Freezing the element causes all consecutive text nodes to be concatenated into single node. If the resulting text node is empty, it is removed. Listeners are discarded on this and descendant elements with null DomElement.id(). All internal arrays are compacted, so that the frozen DOM tree takes up minimum amount of memory. None of these transformations modifies the original element in any way.
        Overrides:
        freeze in class DomElement
        Returns:
        Deep frozen clone. Returns this if this element is already frozen.