Interface CSSElement

All Superinterfaces:
CSSNode, Element, Node
All Known Implementing Classes:
CSSStylableElement, DOMElement, HTMLElement, XHTMLElement

public interface CSSElement extends Element, CSSNode
Essentially adds CSS-related methods to the DOM's Element interface.
  • Method Details

    • getComputedStyle

      CSSComputedProperties getComputedStyle(String pseudoElt)
      Gets the computed style declaration that applies to this element.
      Parameters:
      pseudoElt - the pseudo-element name (null if no pseudo-element).
      Returns:
      the computed style declaration.
    • getId

      String getId()
      Gets the id attribute of this element.
      Returns:
      the id attribute, or the empty string if has no ID.
    • getOverrideStyle

      CSSStyleDeclaration getOverrideStyle(Condition pseudoElt)
      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.

      Parameters:
      pseudoElt - the pseudo-element condition, or null if none.
      Returns:
      the override style sheet for the given pseudo-element.
    • hasOverrideStyle

      boolean hasOverrideStyle(Condition pseudoElt)
      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 getOverrideStyle(Condition) and checking its length.

      Parameters:
      pseudoElt - the pseudo-element condition, or null if none.
      Returns:
      true if this element has an override style declaration for pseudoElt.
    • getStyle

      The inline style.
      Returns:
      the inline style specified by the style attribute, or null if that attribute is not present.
    • matches

      boolean matches(String selectorString, String pseudoElement) throws DOMException
      Does this element (with the provided pseudo-element, if any) match the provided selector string ?
      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

      boolean matches(SelectorList selist, Condition pseudoElement)
      Does this element (with the provided pseudo-element, if any) match the provided selector list ?
      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.
    • getSelectorMatcher

      SelectorMatcher getSelectorMatcher()
      Gets a selector matcher associated to this element.
      Returns:
      a selector matcher associated to this element.
    • hasPresentationalHints

      boolean hasPresentationalHints()
      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 exportHintsToStyle(CSSStyleDeclaration) method.

      Returns:
      true if this element has presentational hints.
    • exportHintsToStyle

      void exportHintsToStyle(CSSStyleDeclaration style) throws DOMException
      Export this element's non-CSS presentational hints (if any) to the supplied CSSStyleDeclaration.
      Parameters:
      style - the style declaration to export to.
      Throws:
      DOMException