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-class
Appends a custom selector.#my-id
sibling()
.foo ~ .bar
sub()
.foo .bar
input
toString()
-
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 > .bar
Appends a child selector that selects nodes that are direct children of the first element.
- Returns:
- This builder instance for chaining method calls.
-
clazz
.my-class
Appends 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-id
Appends 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 ~ .bar
Appends a child selector that selects the siblings.
- Returns:
- This builder instance for chaining method calls.
-
sub
.foo .bar
Appends a selector for matching elements in the subtree of the currently matching element.
- Returns:
- This builder instance for chaining method calls.
-
tagName
input
Appends 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
-