Class StyleElement

java.lang.Object
org.htmlunit.css.StyleElement
All Implemented Interfaces:
Serializable, Comparable<StyleElement>

public class StyleElement extends Object implements Comparable<StyleElement>, Serializable
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Contains information about a single style element, including its name, its value, and an index which can be compared against other indices in order to determine precedence.
See Also:
  • Field Details

    • PRIORITY_IMPORTANT

      public static final String PRIORITY_IMPORTANT
      CSS important property constant.
      See Also:
    • ElementIndex_

      private static final AtomicLong ElementIndex_
      The current style element index.
    • name_

      private final String name_
    • value_

      private final String value_
    • priority_

      private final String priority_
    • index_

      private final long index_
    • specificity_

      private final org.htmlunit.cssparser.parser.selector.SelectorSpecificity specificity_
  • Constructor Details

    • StyleElement

      public StyleElement(String name, String value, String priority, org.htmlunit.cssparser.parser.selector.SelectorSpecificity specificity, long index)
      Creates a new instance.
      Parameters:
      name - the style element's name
      value - the style element's value
      priority - the style element's priority like "important"
      specificity - the specificity of the rule providing this style information
      index - the style element's index
    • StyleElement

      public StyleElement(String name, String value, String priority, org.htmlunit.cssparser.parser.selector.SelectorSpecificity specificity)
      Creates a new instance.
      Parameters:
      name - the style element's name
      value - the style element's value
      priority - the style element's priority like "important"
      specificity - the specificity of the rule providing this style information
  • Method Details

    • getName

      public String getName()
      Returns the style element's name.
      Returns:
      the style element's name
    • getValue

      public String getValue()
      Returns the style element's value.
      Returns:
      the style element's value
    • getPriority

      public String getPriority()
      Returns the style element's priority.
      Returns:
      the style element's priority
    • isImportant

      public boolean isImportant()
      Returns:
      true if priority is 'important'
    • getSpecificity

      public org.htmlunit.cssparser.parser.selector.SelectorSpecificity getSpecificity()
      Returns the specificity of the rule specifying this element.
      Returns:
      the specificity
    • getIndex

      public long getIndex()
      Returns the style element's index.
      Returns:
      the style element's index
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(StyleElement e)
      Specified by:
      compareTo in interface Comparable<StyleElement>