Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–166 unchanged (166 lines)
167 } catch (MalformedURLException e) {
168 // the base is unsuitable, but the attribute may be abs on its own, so try that
169 URL abs = new URL(relUrl);
170 return abs.toExternalForm();
171 }
172 // workaround: java resolves '//path/file + ?foo' to '//path/?foo', not '//path/file?foo' as desired
173 URL abs = new URL(base, relUrl);
174 return abs.toExternalForm();
175 } catch (MalformedURLException e) {
176 return "";
177 }
178 }
179 }
…lines 180–454 unchanged (275 lines)

After

…lines 1–166 unchanged (166 lines)
167 } catch (MalformedURLException e) {
168 // the base is unsuitable, but the attribute may be abs on its own, so try that
169 URL abs = new URL(relUrl);
170 return abs.toExternalForm();
171 }
172 // workaround: java resolves '//path/file + ?foo' to '//path/?foo', not '//path/file?foo' as desired
173 if (relUrl.startsWith("?"))
174 relUrl = base.getPath() + relUrl;
175 URL abs = new URL(base, relUrl);
176 return abs.toExternalForm();
177 } catch (MalformedURLException e) {
178 return "";
179 }
180 }
…lines 181–456 unchanged (276 lines)

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "StringUtil"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "select"
. "."
identifier "NodeTraversor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "select"
. "."
identifier "NodeVisitor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "net"
. "."
identifier "MalformedURLException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "net"
. "."
identifier "URL"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collections"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n The base, abstract Node model. Elements, Documents, Com"...
class_declaration
modifiers
public "public"
abstract "abstract"
class "class"
identifier "Node"
super_interfaces
implements "implements"
type_list
type_identifier "Cloneable"
class_body
{ "{"
field_declaration
type_identifier "Node"
variable_declarator
identifier "parentNode"
; ";"
field_declaration
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "childNodes"
; ";"
field_declaration
type_identifier "Attributes"
variable_declarator
identifier "attributes"
; ";"
field_declaration
type_identifier "String"
variable_declarator
identifier "baseUri"
; ";"
field_declaration
integral_type
int "int"
variable_declarator
identifier "siblingIndex"
; ";"
block_comment "/**\n Create a new Node.\n @param baseUri base URI\n "...
constructor_declaration (+78 nodes collapsed)
constructor_declaration (+27 nodes collapsed)
block_comment "/**\n * Default constructor. Doesn't setup base uri, chil"...
constructor_declaration (+25 nodes collapsed)
block_comment "/**\n Get the node name of this node. Use for debugging p"...
method_declaration
modifiers
public "public"
abstract "abstract"
type_identifier "String"
identifier "nodeName"
formal_parameters
( "("
) ")"
; ";"
block_comment "/**\n * Get an attribute's value by its key.\n * <p/>\n"...
method_declaration (+101 nodes collapsed)
block_comment "/**\n * Get all of the element's attributes.\n * @retu"...
method_declaration
modifiers
public "public"
type_identifier "Attributes"
identifier "attributes"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "attributes"
; ";"
} "}"
block_comment "/**\n * Set an attribute (key=value). If the attribute al"...
method_declaration (+34 nodes collapsed)
block_comment "/**\n * Test if this element has an attribute.\n * @pa"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Remove an attribute from this element.\n * @pa"...
method_declaration (+38 nodes collapsed)
block_comment "/**\n Get the base URI of this node.\n @return base UR"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "baseUri"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "baseUri"
; ";"
} "}"
block_comment "/**\n Update the base URI of this node.\n @param baseU"...
method_declaration (+33 nodes collapsed)
block_comment "/**\n * Get an absolute URL from a URL attribute that may"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "absUrl"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "attributeKey"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "Validate"
. "."
identifier "notEmpty"
argument_list
( "("
identifier "attributeKey"
) ")"
; ";"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "relUrl"
= "="
method_invocation
identifier "attr"
argument_list
( "("
identifier "attributeKey"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "hasAttr"
argument_list
( "("
identifier "attributeKey"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
string_literal
" "\""
" "\""
; ";"
line_comment "// nothing to make absolute with"
} "}"
else "else"
block
{ "{"
local_variable_declaration
type_identifier "URL"
variable_declarator
identifier "base"
; ";"
try_statement
try "try"
block
{ "{"
try_statement (+52 nodes collapsed)
line_comment "// workaround: java resolves '//path/file + ?foo' to '//path"...
local_variable_declaration
type_identifier "URL"
variable_declarator
identifier "abs"
= "="
object_creation_expression
new "new"
type_identifier "URL"
argument_list
( "("
identifier "base"
, ","
identifier "relUrl"
) ")"
; ";"
return_statement
return "return"
method_invocation
identifier "abs"
. "."
identifier "toExternalForm"
argument_list
( "("
) ")"
; ";"
} "}"
catch_clause
catch "catch"
( "("
catch_formal_parameter
catch_type
type_identifier "MalformedURLException"
identifier "e"
) ")"
block
{ "{"
return_statement
return "return"
string_literal
" "\""
" "\""
; ";"
} "}"
} "}"
} "}"
block_comment "/**\n Get a child node by index\n @param index index o"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n Get this node's children. Presented as an unmodifia"...
method_declaration (+27 nodes collapsed)
method_declaration (+42 nodes collapsed)
block_comment "/**\n Gets this node's parent node.\n @return parent n"...
method_declaration
modifiers
public "public"
type_identifier "Node"
identifier "parent"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "parentNode"
; ";"
} "}"
block_comment "/**\n * Gets the Document associated with this Node. \n "...
method_declaration (+53 nodes collapsed)
block_comment "/**\n * Remove (delete) this node from the DOM tree. If t"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Replace this node in the DOM with the supplied no"...
method_declaration (+46 nodes collapsed)
method_declaration (+48 nodes collapsed)
method_declaration (+122 nodes collapsed)
method_declaration (+70 nodes collapsed)
method_declaration (+65 nodes collapsed)
method_declaration (+98 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+57 nodes collapsed)
block_comment "/**\n Retrieves this node's sibling nodes. Effectively, {"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n Get this node's next sibling.\n @return next sib"...
method_declaration (+98 nodes collapsed)
block_comment "/**\n Get this node's previous sibling.\n @return the "...
method_declaration (+75 nodes collapsed)
block_comment "/**\n * Get the list index of this node in its node sibli"...
method_declaration
modifiers
public "public"
type_identifier "Integer"
identifier "siblingIndex"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "siblingIndex"
; ";"
} "}"
method_declaration (+24 nodes collapsed)
block_comment "/**\n Get the outer HTML of this node.\n @return HTML\n"...
method_declaration (+45 nodes collapsed)
method_declaration (+42 nodes collapsed)
line_comment "// if this node has no document (or parent), retrieve the de"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n Get the outer HTML of this node.\n @param accum "...
method_declaration (+24 nodes collapsed)
method_declaration (+24 nodes collapsed)
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "toString"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "outerHtml"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration (+62 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+71 nodes collapsed)
block_comment "/**\n * Create a stand-alone, deep copy of this node, and"...
method_declaration (+24 nodes collapsed)
method_declaration (+179 nodes collapsed)
class_declaration (+157 nodes collapsed)
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "StringUtil"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "select"
. "."
identifier "NodeTraversor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "select"
. "."
identifier "NodeVisitor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "net"
. "."
identifier "MalformedURLException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "net"
. "."
identifier "URL"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Collections"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n The base, abstract Node model. Elements, Documents, Com"...
class_declaration
modifiers
public "public"
abstract "abstract"
class "class"
identifier "Node"
super_interfaces
implements "implements"
type_list
type_identifier "Cloneable"
class_body
{ "{"
field_declaration
type_identifier "Node"
variable_declarator
identifier "parentNode"
; ";"
field_declaration
generic_type
type_identifier "List"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "childNodes"
; ";"
field_declaration
type_identifier "Attributes"
variable_declarator
identifier "attributes"
; ";"
field_declaration
type_identifier "String"
variable_declarator
identifier "baseUri"
; ";"
field_declaration
integral_type
int "int"
variable_declarator
identifier "siblingIndex"
; ";"
block_comment "/**\n Create a new Node.\n @param baseUri base URI\n "...
constructor_declaration (+78 nodes collapsed)
constructor_declaration (+27 nodes collapsed)
block_comment "/**\n * Default constructor. Doesn't setup base uri, chil"...
constructor_declaration (+25 nodes collapsed)
block_comment "/**\n Get the node name of this node. Use for debugging p"...
method_declaration
modifiers
public "public"
abstract "abstract"
type_identifier "String"
identifier "nodeName"
formal_parameters
( "("
) ")"
; ";"
block_comment "/**\n * Get an attribute's value by its key.\n * <p/>\n"...
method_declaration (+101 nodes collapsed)
block_comment "/**\n * Get all of the element's attributes.\n * @retu"...
method_declaration
modifiers
public "public"
type_identifier "Attributes"
identifier "attributes"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "attributes"
; ";"
} "}"
block_comment "/**\n * Set an attribute (key=value). If the attribute al"...
method_declaration (+34 nodes collapsed)
block_comment "/**\n * Test if this element has an attribute.\n * @pa"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Remove an attribute from this element.\n * @pa"...
method_declaration (+38 nodes collapsed)
block_comment "/**\n Get the base URI of this node.\n @return base UR"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "baseUri"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "baseUri"
; ";"
} "}"
block_comment "/**\n Update the base URI of this node.\n @param baseU"...
method_declaration (+33 nodes collapsed)
block_comment "/**\n * Get an absolute URL from a URL attribute that may"...
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "absUrl"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "attributeKey"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "Validate"
. "."
identifier "notEmpty"
argument_list
( "("
identifier "attributeKey"
) ")"
; ";"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "relUrl"
= "="
method_invocation
identifier "attr"
argument_list
( "("
identifier "attributeKey"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
method_invocation
identifier "hasAttr"
argument_list
( "("
identifier "attributeKey"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
string_literal
" "\""
" "\""
; ";"
line_comment "// nothing to make absolute with"
} "}"
else "else"
block
{ "{"
local_variable_declaration
type_identifier "URL"
variable_declarator
identifier "base"
; ";"
try_statement
try "try"
block
{ "{"
try_statement (+52 nodes collapsed)
line_comment "// workaround: java resolves '//path/file + ?foo' to '//path"...
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "relUrl"
. "."
identifier "startsWith"
argument_list
( "("
string_literal
" "\""
string_fragment "?"
" "\""
) ")"
) ")"
expression_statement
assignment_expression
identifier "relUrl"
= "="
binary_expression
method_invocation
identifier "base"
. "."
identifier "getPath"
argument_list
( "("
) ")"
+ "+"
identifier "relUrl"
; ";"
local_variable_declaration
type_identifier "URL"
variable_declarator
identifier "abs"
= "="
object_creation_expression
new "new"
type_identifier "URL"
argument_list
( "("
identifier "base"
, ","
identifier "relUrl"
) ")"
; ";"
return_statement
return "return"
method_invocation
identifier "abs"
. "."
identifier "toExternalForm"
argument_list
( "("
) ")"
; ";"
} "}"
catch_clause
catch "catch"
( "("
catch_formal_parameter
catch_type
type_identifier "MalformedURLException"
identifier "e"
) ")"
block
{ "{"
return_statement
return "return"
string_literal
" "\""
" "\""
; ";"
} "}"
} "}"
} "}"
block_comment "/**\n Get a child node by index\n @param index index o"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n Get this node's children. Presented as an unmodifia"...
method_declaration (+27 nodes collapsed)
method_declaration (+42 nodes collapsed)
block_comment "/**\n Gets this node's parent node.\n @return parent n"...
method_declaration
modifiers
public "public"
type_identifier "Node"
identifier "parent"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "parentNode"
; ";"
} "}"
block_comment "/**\n * Gets the Document associated with this Node. \n "...
method_declaration (+53 nodes collapsed)
block_comment "/**\n * Remove (delete) this node from the DOM tree. If t"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Replace this node in the DOM with the supplied no"...
method_declaration (+46 nodes collapsed)
method_declaration (+48 nodes collapsed)
method_declaration (+122 nodes collapsed)
method_declaration (+70 nodes collapsed)
method_declaration (+65 nodes collapsed)
method_declaration (+98 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+57 nodes collapsed)
block_comment "/**\n Retrieves this node's sibling nodes. Effectively, {"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n Get this node's next sibling.\n @return next sib"...
method_declaration (+98 nodes collapsed)
block_comment "/**\n Get this node's previous sibling.\n @return the "...
method_declaration (+75 nodes collapsed)
block_comment "/**\n * Get the list index of this node in its node sibli"...
method_declaration
modifiers
public "public"
type_identifier "Integer"
identifier "siblingIndex"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "siblingIndex"
; ";"
} "}"
method_declaration (+24 nodes collapsed)
block_comment "/**\n Get the outer HTML of this node.\n @return HTML\n"...
method_declaration (+45 nodes collapsed)
method_declaration (+42 nodes collapsed)
line_comment "// if this node has no document (or parent), retrieve the de"...
method_declaration (+57 nodes collapsed)
block_comment "/**\n Get the outer HTML of this node.\n @param accum "...
method_declaration (+24 nodes collapsed)
method_declaration (+24 nodes collapsed)
method_declaration
modifiers
public "public"
type_identifier "String"
identifier "toString"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
identifier "outerHtml"
argument_list
( "("
) ")"
; ";"
} "}"
method_declaration (+62 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+71 nodes collapsed)
block_comment "/**\n * Create a stand-alone, deep copy of this node, and"...
method_declaration (+24 nodes collapsed)
method_declaration (+179 nodes collapsed)
class_declaration (+157 nodes collapsed)
} "}"