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–36 unchanged (36 lines)
37 @return cleaned document.
38 */
39 public Document clean(Document dirtyDocument) {
40 Validate.notNull(dirtyDocument);
41
42 Document clean = Document.createShell(dirtyDocument.baseUri());
43 copySafeNodes(dirtyDocument.body(), clean.body());
44
45 return clean;
46 }
47
48 /**
49 Determines if the input document is valid, against the whitelist. It is considered valid if all the tags and attributes
…lines 50–130 unchanged (81 lines)

After

…lines 1–36 unchanged (36 lines)
37 @return cleaned document.
38 */
39 public Document clean(Document dirtyDocument) {
40 Validate.notNull(dirtyDocument);
41
42 Document clean = Document.createShell(dirtyDocument.baseUri());
43 if (dirtyDocument.body() != null) // frameset documents won't have a body. the clean doc will have empty body.
44 copySafeNodes(dirtyDocument.body(), clean.body());
45
46 return clean;
47 }
48
49 /**
…lines 50–131 unchanged (82 lines)

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "safety"
; ";"
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
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
. "."
identifier "Tag"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n The whitelist based HTML cleaner. Use to ensure that en"...
class_declaration
modifiers
public "public"
class "class"
identifier "Cleaner"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "Whitelist"
variable_declarator
identifier "whitelist"
; ";"
block_comment "/**\n Create a new cleaner, that sanitizes documents usin"...
constructor_declaration (+32 nodes collapsed)
block_comment "/**\n Creates a new, clean document, from the original di"...
method_declaration
modifiers
public "public"
type_identifier "Document"
identifier "clean"
formal_parameters
( "("
formal_parameter
type_identifier "Document"
identifier "dirtyDocument"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "Validate"
. "."
identifier "notNull"
argument_list
( "("
identifier "dirtyDocument"
) ")"
; ";"
local_variable_declaration
type_identifier "Document"
variable_declarator
identifier "clean"
= "="
method_invocation
identifier "Document"
. "."
identifier "createShell"
argument_list
( "("
method_invocation
identifier "dirtyDocument"
. "."
identifier "baseUri"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement (+22 nodes collapsed)
return_statement
return "return"
identifier "clean"
; ";"
} "}"
block_comment "/**\n Determines if the input document is valid, against "...
method_declaration (+78 nodes collapsed)
block_comment "/**\n Iterates the input and copies trusted nodes (tags, "...
method_declaration (+246 nodes collapsed)
method_declaration (+170 nodes collapsed)
class_declaration (+54 nodes collapsed)
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "safety"
; ";"
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
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
. "."
identifier "Tag"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n The whitelist based HTML cleaner. Use to ensure that en"...
class_declaration
modifiers
public "public"
class "class"
identifier "Cleaner"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "Whitelist"
variable_declarator
identifier "whitelist"
; ";"
block_comment "/**\n Create a new cleaner, that sanitizes documents usin"...
constructor_declaration (+32 nodes collapsed)
block_comment "/**\n Creates a new, clean document, from the original di"...
method_declaration
modifiers
public "public"
type_identifier "Document"
identifier "clean"
formal_parameters
( "("
formal_parameter
type_identifier "Document"
identifier "dirtyDocument"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "Validate"
. "."
identifier "notNull"
argument_list
( "("
identifier "dirtyDocument"
) ")"
; ";"
local_variable_declaration
type_identifier "Document"
variable_declarator
identifier "clean"
= "="
method_invocation
identifier "Document"
. "."
identifier "createShell"
argument_list
( "("
method_invocation
identifier "dirtyDocument"
. "."
identifier "baseUri"
argument_list
( "("
) ")"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "dirtyDocument"
. "."
identifier "body"
argument_list
( "("
) ")"
!= "!="
null_literal "null"
) ")"
line_comment "// frameset documents won't have a body. the clean doc will "...
expression_statement (+22 nodes collapsed)
return_statement
return "return"
identifier "clean"
; ";"
} "}"
block_comment "/**\n Determines if the input document is valid, against "...
method_declaration (+78 nodes collapsed)
block_comment "/**\n Iterates the input and copies trusted nodes (tags, "...
method_declaration (+246 nodes collapsed)
method_declaration (+170 nodes collapsed)
class_declaration (+54 nodes collapsed)
} "}"