Package jodd.jerry
Class Jerry
java.lang.Object
jodd.jerry.Jerry
Jerry is JQuery in Java.
-
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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EMPTY
- See Also:
-
parent
-
nodes
-
builder
-
-
Constructor Details
-
Jerry
Creates root Jerry. -
Jerry
Creates child Jerry. -
Jerry
Creates child Jerry. -
Jerry
Creates child 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
Gets the descendants of each element in the current set of matched elements, filtered by a selector. -
s
Selects nodes.- See Also:
-
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
Adds elements to the set of matched elements. -
end
Ends the most recent filtering operation in the current chain and returns the set of matched elements to its previous state. -
not
Removes elements from the set of matched elements. -
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
Reduces the set of matched elements to those that match the selector. -
filter
Reduces the set of matched elements to those that pass thefunction'stest. -
has
Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. -
attr
Gets the value of an attribute for the first element in the set of matched elements. Returnsnullif set is empty. -
attr
Sets one or more attributes for the set of matched elements. -
removeAttr
Removes an attribute from each element in the set of matched elements. -
css
Gets the value of a style property for the first element in the set of matched elements. Returnsnullif set is empty. -
css
Sets one or more CSS properties for the set of matched elements. By passing an empty value, that property will be removed. Note that this is different from jQuery, where this means that property will be reset to previous value if existed. -
css
Sets one or more CSS properties for the set of matched elements. -
addClass
Adds the specified class(es) to each of the set of matched elements. -
hasClass
Determines whether any of the matched elements are assigned the given class. -
removeClass
Removes a single class, multiple classes, or all classes from each element in the set of matched elements. -
toggleClass
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. -
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
Sets the content of each element in the set of matched elements to the specified 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
Sets the HTML contents of each element in the set of matched elements. -
append
Inserts content, specified by the parameter, to the end of each element in the set of matched elements. -
prepend
Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. -
before
Inserts content, specified by the parameter, before each element in the set of matched elements. -
after
Inserts content, specified by the parameter, after each element in the set of matched elements. -
replaceWith
Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. -
remove
Removes the set of matched elements from the DOM. -
detach
Removes the set of matched elements from the DOM. Identical toremove(). -
empty
Removes all child nodes of the set of matched elements from the DOM. -
wrap
Wraps an HTML structure around each element in the set of matched elements. Returns the original set of elements for chaining purposes. -
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
Returns iterator over nodes contained in the Jerry object. Each node is wrapped. Similar toeach(JerryFunction). -
form
Processes all forms, collects all form parameters and calls back theJerryFormHandler. -
createPropertiesSet
-
generateAttributeValue
-
createPropertiesMap
-
generateAttributeValue
-