META-INF.CHANGES Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsoup Show documentation
Show all versions of jsoup Show documentation
jsoup is a Java library for working with real-world HTML. It provides a very convenient API for extracting and manipulating data, using the best of DOM, CSS, and jquery-like methods. jsoup implements the WHATWG HTML5 specification, and parses HTML to the same DOM as modern browsers do.
jsoup changelog
*** Release 1.14.3 [PENDING]
* Improvement: added native XPath support in Element#selectXpath(String)
* Improvement: added full support for the tag to the HTML5 parser spec.
* Improvement: added support in CharacterReader to track newlines, so that parse errors can be reported more
intuitively.
* Improvement: tracked parse errors now have more details, including the erroneous token, to help clarify the errors.
* Improvement: speed and memory optimizations for the :has(subquery) selector.
* Improvement: the :contains(text) and :containsOwn(text) selectors are now whitespace normalized, aligning to the
document text that they are matching against.
* Improvement: in Element, speed optimized adopting all of an element's child nodes into a currently empty element.
Improves the HTML adoption agency algorithm when adopting elements with many children.
* Improvement: increased the parse speed when in RCData (e.g. ) and unescaped tokens are found, by
memoizing the scan and reducing GC.
* Improvement: when parsing custom tags (in HTML or XML), added a flyweight cache on Tag.valueOf(name) to reduce
memory overhead when many tags are repeated. Also tuned other areas of the parser when many very deeply stacked
custom elements were present.
* Bugfix: when tracking errors or checking for validity in the Cleaner, errors were incorrectly raised for missing
optional closing tags.
* Bugfix: the OSGi bundle meta-data incorrectly set a version on the import of javax.annotation (used as a build-time
dependency for nullability assertions).
* Bugfix: the Attributes::equals() method was sensitive to the order of its contents, but it should not be.
* Bugfix: when the HTML parser was configured to preserve case, Element text methods would miss adding whitespace for
"BR" tags.
* Bugfix: attribute names are now normalized & validated correctly for the specific output syntax (HTML or XML).
Previously, syntactically invalid attribute names could be output by the html() methods. Such attributes are still
available in the DOM, and will be normalized if possible on output.
* Bugfix [Fuzz]: fixed an IOOB when an empty select tag was followed by a body tag that needed reparenting.
* Build Improvement: fixed nullability annotations for Node.equals(other) and other equals methods.
* Build Improvement: added JDK 17 to the CI builds.
*** Release 1.14.2 [2021-Aug-15]
* Improvement: support Pattern.quote \Q and \E escapes in the selector regex matchers.
* Improvement: Element.absUrl() now supports tel: URLs, and other URLs that are already absolute but that Java does
not have input stream handlers for.
* Bugfix: when serializing output, escape characters that are in the < 0x20 range. This improves XML output
compatibility, and makes HTML output with these characters easier to read (as they're otherwise invisible).
* Bugfix: the *|el wildcard namespace selector now also matches elements with no namespace.
* Bugfix: corrected a potential case of the parser input stream not being closed immediately on a read exception.
* Bugfix: when making a HTTP POST, if the request write fails, make sure the connection is immediately cleaned up.
* Bugfix: in the XML parser, XML processing instructions without attributes would be serialized as if they did.
* Bugfix: updated the HtmlTreeParser resetInsertionMode to the current spec for supported elements.
* Bugfix: fixed an NPE when parsing fragment HTML into a standalone table element.
* Bugfix: fixed an NPE when parsing fragment heading HTML into a standalone p element.
* Bugfix: fixed an IOOB when parsing a formatting fragment into a standalone p element.
* Bugfix: tag names must start with an ascii-alpha character.
* Bugfix [Fuzz]: fixed a slow parse when a tag or an attribute name has thousands of null characters in it.
* Bugfix [Fuzz]: the adoption agency algorithm can have an incorrect bookmark position
* Bugfix [Fuzz]: malformed HTML could result in null elements on stack
* Bugfix [Fuzz]: malformed deeply nested table elements could create a stack overflow.
* Bugfix [Fuzz]: Speed optimized malformed HTML creating elements with thousands of elements - limit the attribute
count per element when parsing to 512 (in real-world HTML, P99 is ~ 8).
* Bugfix [Fuzz]: Speed improvement for the foster formatting elements algo, by limiting how far up a crafted stack
to scan.
* Bugfix [Fuzz]: Speed improvement when parsing crafted HTML when transferring form attributes.
* Bugfix [Fuzz]: Speed improvement when the stack was thousands of items deep, and non-matching close tags sent.
* Bugfix [Fuzz]: Speed improvement when an attribute name is 600K of quote characters or otherwise needs accumulation
vs being able to read in one hit.
* Bugfix [Fuzz]: Speed improvement when closing missing empty tags (in XML comment processed as HTML) when thousands
deep in stack.
* Bugfix [Fuzz]: Fix a potential stack-overflow in the parser given crafted HTML, when the parser looped in the
InSelectInTable state.
* Bugfix [Fuzz]: Fix an IOOB when the HTML root was cleared from the stack and then attributes were merged onto it.
* Bugfix [Fuzz]: Improved the speed of parsing when crafted HTML contains hundreds of active formatting elements
that were copied for all new elements (similar to an amplification attack). The number of considered active
formatting elements that will be cloned when mis-nested is now capped to 12.
*** Release 1.14.1 [2021-Jul-10]
* Change: updated the minimum supported Java version from Java 7 to Java 8.
* Change: updated the minimum Android API level from 8 to 10.
* Change: although Node#childNodes() returns an UnmodifiableList as a view into its children, it was still
directly backed by the internal child list. That made some uses, such as looping and moving those children to
another element, throw a ConcurrentModificationException. Now this method returns its own list so that they are
separated and changes to the parent's contents will not impact the children view. This aligns with similar methods
such as Element#children(). If you have code that iterates this list and makes parenting changes to its contents,
you may need to make a code update.
* Change: the org.jsoup.Connection interface has been modified to introduce new methods for sessions and the cookie
store. If you have a custom implementation of this interface, you will need to add implementations of these methods.
* Improvement: added HTTP request session management support with Jsoup.newSession(). This extends the Connection
implementation to support (optional) sessions, which allow request defaults (timeout, proxy, etc) to be set once and
then applied to all requests within that session.
Cookies are re-implemented to correctly support path and domain filtering when used within a session. A default
in-memory cookie store is used for the session, or a custom implementation (perhaps disk-persistent, or pre-set)
can be used instead.
Forms submitted using the FormElement#submit() use the same session that was used to fetch the document and so pass
cookies and other defaults appropriately.
The session is multi-thread safe and can execute multiple requests concurrently. If the user accidentally tries to
execute the same request object across multiple threads (vs calling Connection#newRequest()),
that is detected cleanly and a clear exception is thrown (vs weird blowups in input stream reading, or forcing
everything through a synchronized bottleneck.
* Improvement: renamed the Whitelist class to Safelist, with the goal of more inclusive language. A shim is provided
for backwards compatibility (source and binary). This shim is marked as deprecated and will be removed in the
jsoup 1.15.1 release.
* Improvement: added support for Internationalized Domain Names (IDNs) in Jsoup.Connect.
* Improvement: added support for loading and parsing gzipped HTML files in Jsoup.parse(File in, charset, baseUri).
* Improvement: reduced thread contention in HttpConnection and Document.
* Improvement: better parsing performance when under high thread concurrency
* Improvement: added Element#id(String) ID attribute setter.
* Improvement: in Document, #body() and #head() accessors will now automatically create those elements, if they were
missing (e.g. if the Document was not parsed from HTML). Additionally, the #body() method returns the frameset
element (instead of null) for frameset documents.
* Improvement: when cleaning a document, the output settings of the original document are cloned into the cleaned
document.
* Improvement: when parsing XML, disable pretty-printing by default.
* Improvement: much better performance in Node#clone() for large and deeply nested documents. Complexity was O(n^2) or
worse, now O(n).
* Improvement: during traversal using the NodeTraversor, nodes may now be replaced with Node#replaceWith(Node).
* Improvement: added Element#insertChildren and Elment#prependChildren, as convenience methods in addition to
Element#insertChildren(index, children), for bulk moving nodes.
* Improvement: clean up relative URLs with too many .. segments better.
* Build Improvement: integrated jsoup into the OSS Fuzz project, which semi-randomly generates millions of different
HTML and XML input files, searching for areas to improve in the parser for increased robustness and throughput.
* Build Improvement: integrated with GitHub's CodeQL static code analyzer.
* Build Improvement: moved to GitHub Workflows for build verification.
* Build Improvement: updated Jetty (used for integration tests; not bundled) to 9.4.42.
* Build Improvement: added nullability annotations and initial settings.
* Bugfix: corrected the adoption agency algorithm, to handle cases where e.g. a tag incorrectly nests further
tags.
* Bugfix: when parsing HTML, could throw NPEs on some tags (isindex or table>input).
* Bugfix: in HttpConnection.Request, headers beginning with "sec-" (e.g. Sec-Fetch-Mode) were silently discarded by
the underlying Java HttpURLConnection. These are now settable correctly.
* Bugfix: when adding child Nodes to a Node, could incorrectly reparent all nodes if the first parent had the same
length of children as the incoming node list.
* Bugfix: when wrapping an orphaned element, would throw an NPE.
* Bugfix: when wrapping an element with HTML that included multiple sibling elements, those siblings were incorrectly
added as children of the wrapper instead of siblings.
* Bugfix: when setting the content of a script or style tag via the Element#html(String) method, the content is now
treated as a DataNode, not a TextNode. This means that characters like '<' will no longer be incorrectly escaped.
As a related ergonomic improvement, the same behavior applies for Element#text(String) (i.e. the content will be
treated as a DataNode, despite calling the text() method.
* Bugfix: when wrapping HTML around an existing element with Element#wrap(String), will now take the content as
provided and ignore normal HTML tree-building rules. This allows for e.g. a div tag to be placed inside of p tags.
* Bugfix: the Elements#forms() method should return the selected immediate elements that are Forms, not children.
* Bugfix: when creating a selector for an element with Element#cssSelector, if the element used a non-unique ID
attribute, the returned selector may not match the desired element.
* Bugfix: corrected the toString() methods of the Evaluator classes.
* Bugfix: when converting a jsoup document to a W3C document (in W3CDom#convert), if a tag had XML illegal characters,
a DOMException would be thown. Now instead, that tag is represented as a text node.
* Bugfix: if a HTML file ended with an open noscript tag, an "EOF" string would appear in the HTML output.
* Bugfix: when parsing a document as XML, automatically set the output syntax to XML, and ensure that "<" characters
in attributes are escaped as "<" (which is not required in HTML as the quoted attribute contents are safe, but is
required in XML).
* Bugfix: [Fuzz] when parsing an attribute key containing "abs:abs", a validation error would be incorrectly
thrown.
* Bugfix: [Fuzz] could NPE while parsing in resetInsertionMode().
* Bugfix: [Fuzz] when parsing XML, could Stack Overflow when parsing XML declarations.
* Bugfix: [Fuzz] fixed a potential Stack Overflow when parsing mis-nested tfoot tags, and updated the tree parser for
this situation to match the updated HTML5 spec.
* Bugfix: [Fuzz] fixed a potentially slow HTML parse when tags are nested extremely deep (e.g. 88K depth), by limiting
the formatting tag search depth to 256. In practice, it's generally between 4 - 8.
* Bugfix: [Fuzz] when parsing an unterminated RCDATA token (e.g. a tag), could throw an IO Exception "No
buffer left to unconsume" when trying to rewind the buffer.
*** Release 1.13.1 [2020-Feb-29]
* Improvement: added Element#closest(selector), which walks up the tree to find the nearest element matching the
selector.
* Improvement: memory optimizations, reducing the retained size of a Document by ~ 39%, and allocations by ~ 9%:
1. Attributes holder in Elements is only created if the element has attributes
2. Only track the baseUri in an element when it is set via DOM to a new value for a given tree
3. After parsing, do not retain the input character reader (and associated buffers) in the Document#parser
* Improvement: substantial parse speed improvements vs 1.12.x (bringing back to par with previous releases).
* Improvement: when pretty-printing, comments in inline tags are not pushed to a newline
* Improvement: added Attributes#hasDeclaredValueForKey(key) and Attribute#hasDeclaredValueForKeyIgnoreCase(), to check
if an attribute is set but has no value. Useful in place of the deprecated and removed BooleanAttribute class and
instanceof test.
* Improvement: removed old methods and classes that were marked deprecated in previous releases.
* Improvement: added Element#select(Evaluator) and Element#selectFirst(Evaluator), to allow re-use of a parsed CSS
selector if using the same evaluator many times.
* Improvement: added Elements#forms(), Elements#textNodes(), Elements#dataNodes(), and Elements#comments(), as a
convenient way to get access to these node types directly from an element selection.
* Improvement: preserve whitespace before html and head tag, if pretty-printing is off.
* Bugfix: in a