public class InstanceSelector extends java.lang.Object implements Selector
Use it sparingly. Prefer using wider scope selectors (such as type selector or class selector) that are more in line with CSS philosophy.
Equivalent to a style defined in a HTML tag (no CSS selector). Its specificity is (1,0,0,0).
When set on the global stylesheet a rule with an instance selector is automatically removed from the stylesheet rules after garbage collection of the referenced element.
When set on another stylesheet or in a combinator the rule remains applicable for the lifetime of the stylesheet or combinator.
Constructor and Description |
---|
InstanceSelector(Element element)
Creates an instance selector.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
boolean |
fit(Element element)
Checks whether or not the given element fits this selector.
|
int |
getSpecificity()
Gets the selector specificity.
|
int |
hashCode() |
public InstanceSelector(Element element)
element
- the element instance to check.public boolean fit(Element element)
Selector
public int getSpecificity()
Selector
See CSS for more information about calculating a selector's specificity.
getSpecificity
in interface Selector
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object