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–439 unchanged (439 lines)
440 ensureChildNodes();
441 for (int i = children.length - 1; i >= 0; i--) {
442 Node in = children[i];
443 reparentChild(in);
444 childNodes.add(index, in);
445 }
446 reindexChildren(index);
447 }
448
449 protected void ensureChildNodes() {
450 if (childNodes == EMPTY_NODES) {
451 childNodes = new ArrayList<Node>(4);
452 }
…lines 453–680 unchanged (228 lines)

After

…lines 1–438 unchanged (438 lines)
439 Validate.noNullElements(children);
440 ensureChildNodes();
441 for (int i = children.length - 1; i >= 0; i--) {
442 Node in = children[i];
443 reparentChild(in);
444 childNodes.add(index, in);
445 reindexChildren(index);
446 }
447 }
448
449 protected void ensureChildNodes() {
450 if (childNodes == EMPTY_NODES) {
451 childNodes = new ArrayList<Node>(4);
…lines 452–680 unchanged (229 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 "parser"
. "."
identifier "Parser"
; ";"
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 "LinkedList"
; ";"
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 (+22 nodes collapsed)
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 (+67 nodes collapsed)
constructor_declaration (+27 nodes collapsed)
block_comment "/**\n * Default constructor. Doesn't setup base uri, chil"...
constructor_declaration (+22 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 (+103 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 (+113 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 and all of its des"...
method_declaration (+89 nodes collapsed)
block_comment "/**\n * Get an absolute URL from a URL attribute that may"...
method_declaration (+69 nodes collapsed)
block_comment "/**\n Get a child node by its 0-based index.\n @param "...
method_declaration (+26 nodes collapsed)
block_comment "/**\n Get this node's children. Presented as an unmodifia"...
method_declaration (+27 nodes collapsed)
block_comment "/**\n * Returns a deep copy of this node's children. Chan"...
method_declaration (+76 nodes collapsed)
block_comment "/**\n * Get the number of child nodes that this node hold"...
method_declaration (+23 nodes collapsed)
method_declaration (+36 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 this node's parent node. Node overridable by e"...
method_declaration
modifiers
public "public"
final "final"
type_identifier "Node"
identifier "parentNode"
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 * Insert the specified HTML into the DOM before thi"...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Insert the specified node into the DOM before thi"...
method_declaration (+50 nodes collapsed)
block_comment "/**\n * Insert the specified HTML into the DOM after this"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Insert the specified node into the DOM after this"...
method_declaration (+53 nodes collapsed)
method_declaration (+124 nodes collapsed)
block_comment "/**\n Wrap the supplied HTML around this node.\n @para"...
method_declaration (+251 nodes collapsed)
block_comment "/**\n * Removes this node from the DOM, and moves its chi"...
method_declaration (+80 nodes collapsed)
method_declaration (+68 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 (+72 nodes collapsed)
method_declaration
modifiers
protected "protected"
void_type "void"
identifier "addChildren"
formal_parameters
( "("
formal_parameter
integral_type
int "int"
identifier "index"
, ","
spread_parameter
type_identifier "Node"
... "..."
variable_declarator
identifier "children"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "Validate"
. "."
identifier "noNullElements"
argument_list
( "("
identifier "children"
) ")"
; ";"
expression_statement
method_invocation
identifier "ensureChildNodes"
argument_list
( "("
) ")"
; ";"
for_statement
for "for"
( "("
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "i"
= "="
binary_expression
field_access
identifier "children"
. "."
identifier "length"
- "-"
decimal_integer_literal "1"
; ";"
binary_expression
identifier "i"
>= ">="
decimal_integer_literal "0"
; ";"
update_expression
identifier "i"
-- "--"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "in"
= "="
array_access
identifier "children"
[ "["
identifier "i"
] "]"
; ";"
expression_statement
method_invocation
identifier "reparentChild"
argument_list
( "("
identifier "in"
) ")"
; ";"
expression_statement
method_invocation
identifier "childNodes"
. "."
identifier "add"
argument_list
( "("
identifier "index"
, ","
identifier "in"
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "reindexChildren"
argument_list
( "("
identifier "index"
) ")"
; ";"
} "}"
method_declaration (+40 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+61 nodes collapsed)
block_comment "/**\n Retrieves this node's sibling nodes. Similar to {@l"...
method_declaration (+113 nodes collapsed)
block_comment "/**\n Get this node's next sibling.\n @return next sib"...
method_declaration (+86 nodes collapsed)
block_comment "/**\n Get this node's previous sibling.\n @return the "...
method_declaration (+56 nodes collapsed)
block_comment "/**\n * Get the list index of this node in its node sibli"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "siblingIndex"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "siblingIndex"
; ";"
} "}"
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Perform a depth-first traversal through this node"...
method_declaration (+51 nodes collapsed)
block_comment "/**\n Get the outer HTML of this node.\n @return HTML\n"...
method_declaration (+42 nodes collapsed)
method_declaration (+42 nodes collapsed)
line_comment "// if this node has no document (or parent), retrieve the de"...
method_declaration (+55 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 (+22 nodes collapsed)
method_declaration (+62 nodes collapsed)
block_comment "/**\n * Check if this node is equal to another node. A no"...
method_declaration (+141 nodes collapsed)
block_comment "/**\n * Calculates a hash code for this node, which inclu"...
method_declaration (+70 nodes collapsed)
block_comment "/**\n * Create a stand-alone, deep copy of this node, and"...
method_declaration (+175 nodes collapsed)
block_comment "/*\n * Return a clone of the node using the given parent "...
method_declaration (+171 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 "parser"
. "."
identifier "Parser"
; ";"
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 "LinkedList"
; ";"
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 (+22 nodes collapsed)
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 (+67 nodes collapsed)
constructor_declaration (+27 nodes collapsed)
block_comment "/**\n * Default constructor. Doesn't setup base uri, chil"...
constructor_declaration (+22 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 (+103 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 (+113 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 and all of its des"...
method_declaration (+89 nodes collapsed)
block_comment "/**\n * Get an absolute URL from a URL attribute that may"...
method_declaration (+69 nodes collapsed)
block_comment "/**\n Get a child node by its 0-based index.\n @param "...
method_declaration (+26 nodes collapsed)
block_comment "/**\n Get this node's children. Presented as an unmodifia"...
method_declaration (+27 nodes collapsed)
block_comment "/**\n * Returns a deep copy of this node's children. Chan"...
method_declaration (+76 nodes collapsed)
block_comment "/**\n * Get the number of child nodes that this node hold"...
method_declaration (+23 nodes collapsed)
method_declaration (+36 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 this node's parent node. Node overridable by e"...
method_declaration
modifiers
public "public"
final "final"
type_identifier "Node"
identifier "parentNode"
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 * Insert the specified HTML into the DOM before thi"...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Insert the specified node into the DOM before thi"...
method_declaration (+50 nodes collapsed)
block_comment "/**\n * Insert the specified HTML into the DOM after this"...
method_declaration (+31 nodes collapsed)
block_comment "/**\n * Insert the specified node into the DOM after this"...
method_declaration (+53 nodes collapsed)
method_declaration (+124 nodes collapsed)
block_comment "/**\n Wrap the supplied HTML around this node.\n @para"...
method_declaration (+251 nodes collapsed)
block_comment "/**\n * Removes this node from the DOM, and moves its chi"...
method_declaration (+80 nodes collapsed)
method_declaration (+68 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 (+72 nodes collapsed)
method_declaration
modifiers
protected "protected"
void_type "void"
identifier "addChildren"
formal_parameters
( "("
formal_parameter
integral_type
int "int"
identifier "index"
, ","
spread_parameter
type_identifier "Node"
... "..."
variable_declarator
identifier "children"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "Validate"
. "."
identifier "noNullElements"
argument_list
( "("
identifier "children"
) ")"
; ";"
expression_statement
method_invocation
identifier "ensureChildNodes"
argument_list
( "("
) ")"
; ";"
for_statement
for "for"
( "("
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "i"
= "="
binary_expression
field_access
identifier "children"
. "."
identifier "length"
- "-"
decimal_integer_literal "1"
; ";"
binary_expression
identifier "i"
>= ">="
decimal_integer_literal "0"
; ";"
update_expression
identifier "i"
-- "--"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "in"
= "="
array_access
identifier "children"
[ "["
identifier "i"
] "]"
; ";"
expression_statement
method_invocation
identifier "reparentChild"
argument_list
( "("
identifier "in"
) ")"
; ";"
expression_statement
method_invocation
identifier "childNodes"
. "."
identifier "add"
argument_list
( "("
identifier "index"
, ","
identifier "in"
) ")"
; ";"
expression_statement
method_invocation
identifier "reindexChildren"
argument_list
( "("
identifier "index"
) ")"
; ";"
} "}"
} "}"
method_declaration (+40 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+61 nodes collapsed)
block_comment "/**\n Retrieves this node's sibling nodes. Similar to {@l"...
method_declaration (+113 nodes collapsed)
block_comment "/**\n Get this node's next sibling.\n @return next sib"...
method_declaration (+86 nodes collapsed)
block_comment "/**\n Get this node's previous sibling.\n @return the "...
method_declaration (+56 nodes collapsed)
block_comment "/**\n * Get the list index of this node in its node sibli"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "siblingIndex"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "siblingIndex"
; ";"
} "}"
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Perform a depth-first traversal through this node"...
method_declaration (+51 nodes collapsed)
block_comment "/**\n Get the outer HTML of this node.\n @return HTML\n"...
method_declaration (+42 nodes collapsed)
method_declaration (+42 nodes collapsed)
line_comment "// if this node has no document (or parent), retrieve the de"...
method_declaration (+55 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 (+22 nodes collapsed)
method_declaration (+62 nodes collapsed)
block_comment "/**\n * Check if this node is equal to another node. A no"...
method_declaration (+141 nodes collapsed)
block_comment "/**\n * Calculates a hash code for this node, which inclu"...
method_declaration (+70 nodes collapsed)
block_comment "/**\n * Create a stand-alone, deep copy of this node, and"...
method_declaration (+175 nodes collapsed)
block_comment "/*\n * Return a clone of the node using the given parent "...
method_declaration (+171 nodes collapsed)
class_declaration (+157 nodes collapsed)
} "}"