From 2cf9e90e9a482ef80c70264e7e13191c8632d241 Mon Sep 17 00:00:00 2001 From: Jonathan Hedley Date: Mon, 20 Nov 2023 16:59:38 +1100 Subject: [PATCH] Improved accuracy of tracked source positions (#2056) Revised tree builder method names Using more explicit names vs overrides; removed some duplication. Improved accuracy of tracked source positions Track implicit vs explicitly created / closed elements --- CHANGES | 4 + src/main/java/org/jsoup/nodes/LeafNode.java | 5 +- src/main/java/org/jsoup/nodes/Range.java | 34 ++- .../org/jsoup/parser/HtmlTreeBuilder.java | 218 ++++++++---------- .../jsoup/parser/HtmlTreeBuilderState.java | 184 ++++++++------- .../java/org/jsoup/parser/TreeBuilder.java | 128 ++++++---- .../java/org/jsoup/parser/XmlTreeBuilder.java | 79 ++++--- .../java/org/jsoup/nodes/PositionTest.java | 107 ++++++++- 8 files changed, 452 insertions(+), 307 deletions(-) diff --git a/CHANGES b/CHANGES index e0e5995059..87c2d1aee8 100644 --- a/CHANGES +++ b/CHANGES @@ -23,6 +23,10 @@ Release 1.17.1 [PENDING] * Improvement: repackaged the library with native (vs automatic) JPMS module support. + * Improvement: better fidelity of source positions when tracking is enabled. And implicitly created or closed elements + are tracked and detectable via Range.isImplicit(). + + * Bugfix: when outputting with XML syntax, HTML elements that were parsed as data nodes (