Class CssSelectorBuilder
.foo[type=input]- Author:
- XIMA MEDIA GmbH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionattrContains(Object name, Object value) [name*=a]attrContainsPart(Object name, Object value) [lang|=CH]attrContainsWord(Object name, Object value) [name~=red]attrEndsWith(Object name, Object value) [name$=bar]attrEquals(Object name, Object value) [type=input]attrExists(Object name) [type]attrStartsWith(Object name, Object value) [name^=foo]build()child().foo > .bar.my-classAppends a custom selector.#my-idsibling().foo ~ .barsub().foo .barinputtoString()
-
Constructor Details
-
CssSelectorBuilder
public CssSelectorBuilder()
-
-
Method Details
-
attrContains
[name*=a]Appends an attribute selector for matching an attribute that contains the given value.
- Parameters:
name- Name of the attribute to match.value- Value to compare against the attribute.- Returns:
- This builder instance for chaining method calls.
-
attrContainsPart
[lang|=CH]Appends an attribute selector for matching an attribute that contains a hyphen case part the given value.
Precisely, represents elements with an attribute name whose value can be exactly value or can begin with value immediately followed by a hyphen, - (U+002D). It is often used for language subcode matches.
- Parameters:
name- Name of the attribute to match.value- Value to compare against the attribute.- Returns:
- This builder instance for chaining method calls.
-
attrContainsWord
[name~=red]Appends an attribute selector for matching an attribute that contains a word the given value.
- Parameters:
name- Name of the attribute to match.value- Value to compare against the attribute.- Returns:
- This builder instance for chaining method calls.
-
attrEndsWith
[name$=bar]Appends an attribute selector for matching an attribute that ends with the given value.
- Parameters:
name- Name of the attribute to match.value- Value to compare against the attribute.- Returns:
- This builder instance for chaining method calls.
-
attrEquals
[type=input]Appends an attribute selector for matching the attribute value exactly.
- Parameters:
name- Name of the attribute to match.value- Value to compare against the attribute.- Returns:
- This builder instance for chaining method calls.
-
attrExists
[type]Appends an attribute selector for matching an element that has an attribute with the given name.
- Parameters:
name- Name of the attribute to match.- Returns:
- This builder instance for chaining method calls.
-
attrStartsWith
[name^=foo]Appends an attribute selector for matching an attribute that starts with the given value.
- Parameters:
name- Name of the attribute to match.value- Value to compare against the attribute.- Returns:
- This builder instance for chaining method calls.
-
build
- Returns:
- The string representing the CSS selector.
-
child
.foo > .barAppends a child selector that selects nodes that are direct children of the first element.
- Returns:
- This builder instance for chaining method calls.
-
clazz
.my-classAppends a selector for matching elements with the given class name.
- Parameters:
className- Name of the CSS class.- Returns:
- This builder instance for chaining method calls.
-
custom
Appends a custom selector.- Parameters:
selector- Custom selector string to append.- Returns:
- This builder instance for chaining method calls.
-
id
#my-idAppends a selector for matching elements with the given ID.
- Parameters:
id- Name of the HTML tag.- Returns:
- This builder instance for chaining method calls.
-
sibling
.foo ~ .barAppends a child selector that selects the siblings.
- Returns:
- This builder instance for chaining method calls.
-
sub
.foo .barAppends a selector for matching elements in the subtree of the currently matching element.
- Returns:
- This builder instance for chaining method calls.
-
tagName
inputAppends a selector for matching elements with the given tag name.
- Parameters:
tagName- Name of the HTML tag.- Returns:
- This builder instance for chaining method calls.
-
toString
-