Class CSSStylableElement

All Implemented Interfaces:
CSSElement, CSSNode, Serializable, Cloneable, Branch, Element, Node, Element, Node
Direct Known Subclasses:
XHTMLElement

public abstract class CSSStylableElement extends DOMElement implements CSSElement
An element that is stylable with CSS.
See Also:
  • Constructor Details

    • CSSStylableElement

      protected CSSStylableElement(String name)
    • CSSStylableElement

      protected CSSStylableElement(QName qname)
    • CSSStylableElement

      protected CSSStylableElement(QName qname, int attributeCount)
  • Method Details

    • getOwnerDocument

      public XHTMLDocument getOwnerDocument()
      The XHTMLDocument object which is the root ancestor of this node.

      This is also the XHTMLDocument object used to create new nodes.

      Specified by:
      getOwnerDocument in interface CSSNode
      Specified by:
      getOwnerDocument in interface Node
      Overrides:
      getOwnerDocument in class DOMElement
      Returns:
      the XHTMLDocument object which is the root ancestor of this node, or null if this node is an XHTMLDocument, a DocumentType which is not used inside any XHTMLDocument yet, or this node is not part of a document.
    • getDocument

      public XHTMLDocument getDocument()
      Specified by:
      getDocument in interface Node
      Overrides:
      getDocument in class DefaultElement
    • getDocumentFactory

      protected XHTMLDocumentFactory getDocumentFactory()
      Overrides:
      getDocumentFactory in class DOMElement
    • setAttributeNode

      public Attr setAttributeNode(Attr newAttr) throws DOMException
      Specified by:
      setAttributeNode in interface Element
      Overrides:
      setAttributeNode in class DOMElement
      Throws:
      DOMException
    • setAttributeNodeNS

      public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
      Specified by:
      setAttributeNodeNS in interface Element
      Overrides:
      setAttributeNodeNS in class DOMElement
      Throws:
      DOMException
    • attribute

      protected Attribute attribute(Attr attr)
      Overrides:
      attribute in class DOMElement
    • getBaseURI

      public String getBaseURI()
      Specified by:
      getBaseURI in interface Node
      Overrides:
      getBaseURI in class DOMElement
    • getFeature

      @Deprecated public Object getFeature(String feature, String version)
      Deprecated.
      Specified by:
      getFeature in interface Node
      Overrides:
      getFeature in class DOMElement
    • setIdAttribute

      @Deprecated public void setIdAttribute(String name, boolean isId) throws DOMException
      Deprecated.
      Specified by:
      setIdAttribute in interface Element
      Overrides:
      setIdAttribute in class DOMElement
      Throws:
      DOMException
    • setIdAttributeNS

      @Deprecated public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException
      Deprecated.
      Specified by:
      setIdAttributeNS in interface Element
      Overrides:
      setIdAttributeNS in class DOMElement
      Throws:
      DOMException
    • setIdAttributeNode

      @Deprecated public void setIdAttributeNode(Attr idAttr, boolean isId)
      Deprecated.
      Specified by:
      setIdAttributeNode in interface Element
      Overrides:
      setIdAttributeNode in class DOMElement
    • getId

      public abstract String getId()
      Gets the id attribute of this element.
      Specified by:
      getId in interface CSSElement
      Returns:
      the id attribute, or the empty string if has no ID.
    • getStyle

      public CSSStyleDeclaration getStyle()
      Gets the inline style declaration from the current contents of the style XHTML attribute.
      Specified by:
      getStyle in interface CSSElement
      Returns:
      the style declaration, or null if the element has no style attribute.
    • hasPresentationalHints

      public boolean hasPresentationalHints()
      Description copied from interface: CSSElement
      Check whether this element has non-CSS presentational hints.

      A document may contain non-CSS presentational hints (like the width attribute in HTML). This method can return true only if this specific element do contain such hints, which can be exported to a style declaration by using the CSSElement.exportHintsToStyle(CSSStyleDeclaration) method.

      Specified by:
      hasPresentationalHints in interface CSSElement
      Returns:
      true if this element has presentational hints.
    • exportHintsToStyle

      public void exportHintsToStyle(CSSStyleDeclaration style)
      Description copied from interface: CSSElement
      Export this element's non-CSS presentational hints (if any) to the supplied CSSStyleDeclaration.
      Specified by:
      exportHintsToStyle in interface CSSElement
      Parameters:
      style - the style declaration to export to.
    • hasOverrideStyle

      public boolean hasOverrideStyle(Condition pseudoElt)
      Description copied from interface: CSSElement
      Check whether this element has an override style declaration for the given pseudo-element.

      This method allows checking for override styles without the overhead of producing and retrieving one with CSSElement.getOverrideStyle(Condition) and checking its length.

      Specified by:
      hasOverrideStyle in interface CSSElement
      Parameters:
      pseudoElt - the pseudo-element condition, or null if none.
      Returns:
      true if this element has an override style declaration for pseudoElt.
    • getOverrideStyle

      public CSSStyleDeclaration getOverrideStyle(Condition pseudoElt)
      Description copied from interface: CSSElement
      Gets this element's override style declaration for a pseudo-element.

      The getOverrideStyle method provides a mechanism through which a DOM author could effect immediate change to the style of an element without modifying the explicitly linked style sheets of a document or the inline style of elements.

      The override style sheet comes after the author style sheet in the cascade algorithm.

      Specified by:
      getOverrideStyle in interface CSSElement
      Parameters:
      pseudoElt - the pseudo-element condition, or null if none.
      Returns:
      the override style sheet for the given pseudo-element.
    • getComputedStyle

      public ComputedCSSStyle getComputedStyle(String pseudoElt)
      Gets the computed style declaration that applies to this element.
      Specified by:
      getComputedStyle in interface CSSElement
      Parameters:
      pseudoElt - the pseudo-element name.
      Returns:
      the computed style declaration.
    • getComputedStyle

      public ComputedCSSStyle getComputedStyle()
      Gets the computed style declaration that applies to this element.
      Returns:
      the computed style declaration, or null if none applies.
    • getSelectorMatcher

      public SelectorMatcher getSelectorMatcher()
      Gets the selector matcher for this element.
      Specified by:
      getSelectorMatcher in interface CSSElement
      Returns:
      the selector matcher.
    • matches

      public boolean matches(String selectorString, String pseudoElement) throws DOMException
      Description copied from interface: CSSElement
      Does this element (with the provided pseudo-element, if any) match the provided selector string ?
      Specified by:
      matches in interface CSSElement
      Parameters:
      selectorString - the selector string.
      pseudoElement - the pseudo-element, or null if none.
      Returns:
      true if the element would be selected by the specified selector string, false otherwise.
      Throws:
      DOMException - SYNTAX_ERR if there was an error parsing the selector string.
    • matches

      public boolean matches(SelectorList selist, Condition pseudoElement)
      Description copied from interface: CSSElement
      Does this element (with the provided pseudo-element, if any) match the provided selector list ?
      Specified by:
      matches in interface CSSElement
      Parameters:
      selist - the selector list.
      pseudoElement - the pseudo-element condition, or null if none.
      Returns:
      true if the element would be selected by at least one selector in the specified list, false otherwise.