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

1const button = document.getElementById('myButton');
2
3function handleClick() {
4 console.log('Button clicked!');
5}
6
7button.onclick = handleClick;
8

After

1const button = document.getElementById('myButton');
2
3function handleClick() {
4 console.log('Button clicked!');
5}
6
7button.addEventListener('click', handleClick);
8button.addEventListener('click', () => {
9 console.log('Additional click handler');
10});
11

Before

program
lexical_declaration
const "const"
variable_declarator
identifier "button"
= "="
call_expression
member_expression
identifier "document"
. "."
property_identifier "getElementById"
arguments
( "("
string
' "'"
string_fragment "myButton"
' "'"
) ")"
; ";"
function_declaration (+23 nodes collapsed)
expression_statement
assignment_expression
member_expression
identifier "button"
. "."
property_identifier "onclick"
= "="
identifier "handleClick"
; ";"

After

program
lexical_declaration
const "const"
variable_declarator
identifier "button"
= "="
call_expression
member_expression
identifier "document"
. "."
property_identifier "getElementById"
arguments
( "("
string
' "'"
string_fragment "myButton"
' "'"
) ")"
; ";"
function_declaration (+23 nodes collapsed)
expression_statement
call_expression
member_expression
identifier "button"
. "."
property_identifier "addEventListener"
arguments
( "("
string
' "'"
string_fragment "click"
' "'"
, ","
identifier "handleClick"
) ")"
; ";"
expression_statement
call_expression
member_expression
identifier "button"
. "."
property_identifier "addEventListener"
arguments
( "("
string
' "'"
string_fragment "click"
' "'"
, ","
arrow_function
formal_parameters
( "("
) ")"
=> "=>"
statement_block
{ "{"
expression_statement
call_expression
member_expression
identifier "console"
. "."
property_identifier "log"
arguments
( "("
string
' "'"
string_fragment "Additional click handler"
' "'"
) ")"
; ";"
} "}"
) ")"
; ";"