Class Jerry
java.lang.Object
jodd.jerry.Jerry
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates child Jerry.protectedCreates child Jerry.protectedCreates child Jerry.protectedJerry(DOMBuilder builder, Node... nodes) Creates root Jerry. -
Method Summary
Modifier and TypeMethodDescriptionAdds elements to the set of matched elements.Adds the specified class(es) to each of the set of matched elements.Inserts content, specified by the parameter, after each element in the set of matched elements.Inserts content, specified by the parameter, to the end of each element in the set of matched elements.Gets the value of an attribute for the first element in the set of matched elements.Sets one or more attributes for the set of matched elements.Inserts content, specified by the parameter, before each element in the set of matched elements.children()Gets the immediate children of each element in the set of matched elements.contents()Get the children of each element in the set of matched elements, including text and comment nodes.static JerryParsercreate()Just creates newJerry runnerto separate parser creation and creation of new Jerry instances.static JerryParsercreate(DOMBuilder domBuilder) Creates newJerry runnerwith provided implementation ofDOMBuilder.protected NodeSelectorcreateNodeSelector(Node node) Creates node selector.createPropertiesMap(String attrValue, char propertiesDelimiter, char valueDelimiter) createPropertiesSet(String attrValue, char propertiesDelimiter) Gets the value of a style property for the first element in the set of matched elements.Sets one or more CSS properties for the set of matched elements.Sets one or more CSS properties for the set of matched elements.detach()Removes the set of matched elements from the DOM.each(JerryFunction function) Iterates over a jQuery object, executing a function for each matched element.eachNode(JerryNodeFunction function) Iterates over a jQuery object, executing a function for each matched element.empty()Removes all child nodes of the set of matched elements from the DOM.end()Ends the most recent filtering operation in the current chain and returns the set of matched elements to its previous state.eq(int value) Reduces the set of matched elements to the one at the specified index.Reduces the set of matched elements to those that match the selector.filter(JerryFunction jerryFunction) Reduces the set of matched elements to those that pass thefunction'stest.Gets the descendants of each element in the current set of matched elements, filtered by a selector.first()Reduces the set of matched elements to the first in the set.form(String formCssSelector, JerryFormHandler jerryFormHandler) Processes all forms, collects all form parameters and calls back theJerryFormHandler.protected StringgenerateAttributeValue(Map<String, String> map, char propertiesDelimiter, char valueDelimiter) protected StringgenerateAttributeValue(Set<String> set, char propertiesDelimiter) Node[]get()Retrieve all DOM elements matched by this set.get(int index) Returns node at given index.gt(int value) Reduces the set of matched elements to the one at an index greater than specified index.Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.booleanDetermines whether any of the matched elements are assigned the given class.html()Gets the HTML contents of the first element in the set of matched elements.Sets the HTML contents of each element in the set of matched elements.htmlAll(boolean setIncluded) Gets the combined HTML contents of each element in the set of matched elements, including their descendants.intSearches for a givenNodefrom among the matched elements.booleanChecks the current matched set of elements against a selector and returntrueif at least one of these elements matches the given arguments.iterator()Returns iterator over nodes contained in the Jerry object.last()Reduces the set of matched elements to the last in the set.intlength()Returns number of nodes in this Jerry.lt(int value) Reduces the set of matched elements to the one at an index less than specified index.next()Gets the immediately following sibling of each element in the set of matched elements.nextAll()Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.Removes elements from the set of matched elements.static Jerryof(char[] content) Parses input sequence and creates newJerry.static Jerryof(CharSequence content) Parses input content and creates newJerry.parent()Gets the parent of each element in the current set of matched elements.Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.prev()Gets the immediately preceding sibling of each element in the set of matched elements.prevAll()Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.remove()Removes the set of matched elements from the DOM.removeAttr(String name) Removes an attribute from each element in the set of matched elements.removeClass(String... classNames) Removes a single class, multiple classes, or all classes from each element in the set of matched elements.replaceWith(String html) Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.root()Returns root Jerry.Selects nodes.siblings()Gets the siblings of each element in the set of matched elements.intsize()Returns number of nodes in this Jerry.text()Gets the combined text contents of each element in the set of matched elements, including their descendants.Sets the content of each element in the set of matched elements to the specified text.toggleClass(String... classNames) Adds or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.unwrap()Remove the parents of the set of matched elements from the DOM, leaving the matched elements (and siblings, if any) in their place.Wraps an HTML structure around each element in the set of matched elements.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
EMPTY
- See Also:
-
parent
-
nodes
-
builder
-
-
Constructor Details
-
Jerry
Creates root Jerry. -
Jerry
-
Jerry
-
Jerry
-
-
Method Details
-
of
Parses input sequence and creates newJerry. -
of
Parses input content and creates newJerry. -
create
Just creates newJerry runnerto separate parser creation and creation of new Jerry instances. -
create
Creates newJerry runnerwith provided implementation ofDOMBuilder. -
length
public int length()Returns number of nodes in this Jerry. -
size
public int size()Returns number of nodes in this Jerry. -
get
Returns node at given index. Returnsnullif index is out of bounds. -
get
Retrieve all DOM elements matched by this set. Warning: returned array is not a clone! -
index
Searches for a givenNodefrom among the matched elements. -
children
Gets the immediate children of each element in the set of matched elements. -
contents
Get the children of each element in the set of matched elements, including text and comment nodes. -
parent
Gets the parent of each element in the current set of matched elements. -
siblings
Gets the siblings of each element in the set of matched elements. -
next
Gets the immediately following sibling of each element in the set of matched elements. -
nextAll
Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. -
prev
Gets the immediately preceding sibling of each element in the set of matched elements. -
prevAll
Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. -
find
-
s
-
createNodeSelector
Creates node selector. -
each
Iterates over a jQuery object, executing a function for each matched element.- See Also:
-
eachNode
Iterates over a jQuery object, executing a function for each matched element.- See Also:
-
add
-
end
Ends the most recent filtering operation in the current chain and returns the set of matched elements to its previous state. -
not
-
root
Returns root Jerry. -
first
Reduces the set of matched elements to the first in the set. -
last
Reduces the set of matched elements to the last in the set. -
eq
Reduces the set of matched elements to the one at the specified index. -
gt
Reduces the set of matched elements to the one at an index greater than specified index. -
lt
Reduces the set of matched elements to the one at an index less than specified index. -
is
Checks the current matched set of elements against a selector and returntrueif at least one of these elements matches the given arguments. -
filter
-
filter
Reduces the set of matched elements to those that pass thefunction'stest. -
has
-
attr
-
attr
-
removeAttr
-
css
-
css
-
css
-
addClass
-
hasClass
Determines whether any of the matched elements are assigned the given class. -
removeClass
-
toggleClass
-
text
Gets the combined text contents of each element in the set of matched elements, including their descendants. Text is HTML decoded for text nodes. -
text
-
html
Gets the HTML contents of the first element in the set of matched elements. Content is raw, not HTML decoded.- See Also:
-
htmlAll
Gets the combined HTML contents of each element in the set of matched elements, including their descendants.- Parameters:
setIncluded- iftruethan sets node are included in the output- See Also:
-
html
-
append
-
prepend
-
before
-
after
-
replaceWith
-
remove
Removes the set of matched elements from the DOM. -
detach
-
empty
Removes all child nodes of the set of matched elements from the DOM. -
wrap
-
unwrap
Remove the parents of the set of matched elements from the DOM, leaving the matched elements (and siblings, if any) in their place. -
iterator
-
form
Processes all forms, collects all form parameters and calls back theJerryFormHandler. -
createPropertiesSet
-
generateAttributeValue
-
createPropertiesMap
-
generateAttributeValue
-