Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<script>
import { tick } from 'svelte';

let text = $state(`Select some text and hit the tab key to toggle uppercase`);

async function handleKeydown(event) {
if (event.key !== 'Tab') return;

event.preventDefault();

const { selectionStart, selectionEnd, value } = this;
const selection = value.slice(selectionStart, selectionEnd);

const replacement = /[a-z]/.test(selection) ? selection.toUpperCase() : selection.toLowerCase();

text = value.slice(0, selectionStart) + replacement + value.slice(selectionEnd);

await tick();
this.selectionStart = selectionStart;
this.selectionEnd = selectionEnd;
}
</script>

<textarea value={text} onkeydown={handleKeydown}></textarea>

<style>
textarea {
width: 100%;
height: 200px;
}
</style>

import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';
import { tick } from 'svelte';

async function handleKeydown(event, text) {
if (event.key !== 'Tab') return;
event.preventDefault();

const { selectionStart, selectionEnd, value } = this;
const selection = value.slice(selectionStart, selectionEnd);
const replacement = (/[a-z]/).test(selection) ? selection.toUpperCase() : selection.toLowerCase();

$.set(text, value.slice(0, selectionStart) + replacement + value.slice(selectionEnd));
await tick();
this.selectionStart = selectionStart;
this.selectionEnd = selectionEnd;
}

var root = $.template(`<textarea class="svelte-hyxn8s"></textarea>`);

export default function App($$anchor, $$props) {
$.push($$props, true);

let text = $.state(`Select some text and hit the tab key to toggle uppercase`);
var textarea = root();

$.remove_textarea_child(textarea);
textarea.__keydown = [handleKeydown, text];
$.template_effect(() => $.set_value(textarea, $.get(text)));
$.append($$anchor, textarea);
$.pop();
}

$.delegate(['keydown']);
result = svelte.compile(source, {
generate: ,
});

textarea.svelte-hyxn8s {
width: 100%;
height: 200px;
}

		
			
				
  • Root {
    • css: StyleSheet {...}
      • type: "StyleSheet"
      • start: 697
      • end: 760
      • attributes: []
      • children: [...] (1)
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 706
            • end: 714
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 706
                • end: 714
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "textarea"
                        • start: 706
                        • end: 714
                        }
                      ]
                    • start: 706
                    • end: 714
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 715
            • end: 751
            • children: [...] (2)
              • Declaration {...}
                • type: "Declaration"
                • start: 719
                • end: 730
                • property: "width"
                • value: "100%"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 734
                • end: 747
                • property: "height"
                • value: "200px"
                }
              ]
            }
          • start: 706
          • end: 751
          }
        ]
      • content: {...}
        • start: 704
        • end: 752
        • styles: "\n\ttextarea {\n\t\twidth: 100%;\n\t\theight: 200px;\n\t}\n"
        • comment: null
        }
      }
    • js: []
    • start: 635
    • end: 695
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (3)
        • Text {...}
          • type: "Text"
          • start: 633
          • end: 635
          • raw: "\n\n"
          • data: "\n\n"
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 635
          • end: 695
          • name: "textarea"
          • attributes: [...] (3)
            • Attribute {...}
              • type: "Attribute"
              • start: 645
              • end: 657
              • name: "value"
              • value: ExpressionTag {...}
                • type: "ExpressionTag"
                • start: 651
                • end: 657
                • expression: Identifier {...}
                  • type: "Identifier"
                  • start: 652
                  • end: 656
                  • loc: {...}
                    • start: {...}
                      • line: 24
                      • column: 17
                      }
                    • end: {...}
                      • line: 24
                      • column: 21
                      }
                    }
                  • name: "text"
                  }
                }
              }
            • Attribute {...}
              • type: "Attribute"
              • start: 658
              • end: 683
              • name: "onkeydown"
              • value: ExpressionTag {...}
                • type: "ExpressionTag"
                • start: 668
                • end: 683
                • expression: Identifier {...}
                  • type: "Identifier"
                  • start: 669
                  • end: 682
                  • loc: {...}
                    • start: {...}
                      • line: 24
                      • column: 34
                      }
                    • end: {...}
                      • line: 24
                      • column: 47
                      }
                    }
                  • name: "handleKeydown"
                  }
                }
              }
            • Attribute {...}
              • type: "Attribute"
              • start: -1
              • end: -1
              • name: "class"
              • value: [...] (1)
                • Text {...}
                  • type: "Text"
                  • data: "svelte-hyxn8s"
                  • raw: "svelte-hyxn8s"
                  • start: -1
                  • end: -1
                  }
                ]
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: []
            }
          }
        • Text {...}
          • type: "Text"
          • start: 695
          • end: 697
          • raw: "\n\n"
          • data: "\n\n"
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 633
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 624
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 22
            • column: 0
            }
          }
        • body: [...] (3)
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 10
            • end: 40
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 31
                }
              }
            • specifiers: [...] (1)
              • ImportSpecifier {...}
                • type: "ImportSpecifier"
                • start: 19
                • end: 23
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 10
                    }
                  • end: {...}
                    • line: 2
                    • column: 14
                    }
                  }
                • imported: Identifier {...}
                  • type: "Identifier"
                  • start: 19
                  • end: 23
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 10
                      }
                    • end: {...}
                      • line: 2
                      • column: 14
                      }
                    }
                  • name: "tick"
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 19
                  • end: 23
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 10
                      }
                    • end: {...}
                      • line: 2
                      • column: 14
                      }
                    }
                  • name: "tick"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 31
              • end: 39
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 22
                  }
                • end: {...}
                  • line: 2
                  • column: 30
                  }
                }
              • value: "svelte"
              • raw: "'svelte'"
              }
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 43
            • end: 121
            • loc: {...}
              • start: {...}
                • line: 4
                • column: 1
                }
              • end: {...}
                • line: 4
                • column: 79
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 47
                • end: 120
                • loc: {...}
                  • start: {...}
                    • line: 4
                    • column: 5
                    }
                  • end: {...}
                    • line: 4
                    • column: 78
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 47
                  • end: 51
                  • loc: {...}
                    • start: {...}
                      • line: 4
                      • column: 5
                      }
                    • end: {...}
                      • line: 4
                      • column: 9
                      }
                    }
                  • name: "text"
                  }
                • init: CallExpression {...}
                  • type: "CallExpression"
                  • start: 54
                  • end: 120
                  • loc: {...}
                    • start: {...}
                      • line: 4
                      • column: 12
                      }
                    • end: {...}
                      • line: 4
                      • column: 78
                      }
                    }
                  • callee: Identifier {...}
                    • type: "Identifier"
                    • start: 54
                    • end: 60
                    • loc: {...}
                      • start: {...}
                        • line: 4
                        • column: 12
                        }
                      • end: {...}
                        • line: 4
                        • column: 18
                        }
                      }
                    • name: "$state"
                    }
                  • arguments: [...] (1)
                    • TemplateLiteral {...}
                      • type: "TemplateLiteral"
                      • start: 61
                      • end: 119
                      • loc: {...}
                        • start: {...}
                          • line: 4
                          • column: 19
                          }
                        • end: {...}
                          • line: 4
                          • column: 77
                          }
                        }
                      • expressions: []
                      • quasis: [...] (1)
                        • TemplateElement {...}
                          • type: "TemplateElement"
                          • start: 62
                          • end: 118
                          • loc: {...}
                            • start: {...}
                              • line: 4
                              • column: 20
                              }
                            • end: {...}
                              • line: 4
                              • column: 76
                              }
                            }
                          • value: {...}
                            • raw: "Select some text and hit the tab key to toggle uppercase"
                            • cooked: "Select some text and hit the tab key to toggle uppercase"
                            }
                          • tail: true
                          }
                        ]
                      }
                    ]
                  • optional: false
                  }
                }
              ]
            • kind: "let"
            }
          • FunctionDeclaration {...}
            • type: "FunctionDeclaration"
            • start: 124
            • end: 623
            • loc: {...}
              • start: {...}
                • line: 6
                • column: 1
                }
              • end: {...}
                • line: 21
                • column: 2
                }
              }
            • id: Identifier {...}
              • type: "Identifier"
              • start: 139
              • end: 152
              • loc: {...}
                • start: {...}
                  • line: 6
                  • column: 16
                  }
                • end: {...}
                  • line: 6
                  • column: 29
                  }
                }
              • name: "handleKeydown"
              }
            • expression: false
            • generator: false
            • async: true
            • params: [...] (1)
              • Identifier {...}
                • type: "Identifier"
                • start: 153
                • end: 158
                • loc: {...}
                  • start: {...}
                    • line: 6
                    • column: 30
                    }
                  • end: {...}
                    • line: 6
                    • column: 35
                    }
                  }
                • name: "event"
                }
              ]
            • body: BlockStatement {...}
              • type: "BlockStatement"
              • start: 160
              • end: 623
              • loc: {...}
                • start: {...}
                  • line: 6
                  • column: 37
                  }
                • end: {...}
                  • line: 21
                  • column: 2
                  }
                }
              • body: [...] (9)
                • IfStatement {...}
                  • type: "IfStatement"
                  • start: 164
                  • end: 196
                  • loc: {...}
                    • start: {...}
                      • line: 7
                      • column: 2
                      }
                    • end: {...}
                      • line: 7
                      • column: 34
                      }
                    }
                  • test: BinaryExpression {...}
                    • type: "BinaryExpression"
                    • start: 168
                    • end: 187
                    • loc: {...}
                      • start: {...}
                        • line: 7
                        • column: 6
                        }
                      • end: {...}
                        • line: 7
                        • column: 25
                        }
                      }
                    • left: MemberExpression {...}
                      • type: "MemberExpression"
                      • start: 168
                      • end: 177
                      • loc: {...}
                        • start: {...}
                          • line: 7
                          • column: 6
                          }
                        • end: {...}
                          • line: 7
                          • column: 15
                          }
                        }
                      • object: Identifier {...}
                        • type: "Identifier"
                        • start: 168
                        • end: 173
                        • loc: {...}
                          • start: {...}
                            • line: 7
                            • column: 6
                            }
                          • end: {...}
                            • line: 7
                            • column: 11
                            }
                          }
                        • name: "event"
                        }
                      • property: Identifier {...}
                        • type: "Identifier"
                        • start: 174
                        • end: 177
                        • loc: {...}
                          • start: {...}
                            • line: 7
                            • column: 12
                            }
                          • end: {...}
                            • line: 7
                            • column: 15
                            }
                          }
                        • name: "key"
                        }
                      • computed: false
                      • optional: false
                      }
                    • operator: "!=="
                    • right: Literal {...}
                      • type: "Literal"
                      • start: 182
                      • end: 187
                      • loc: {...}
                        • start: {...}
                          • line: 7
                          • column: 20
                          }
                        • end: {...}
                          • line: 7
                          • column: 25
                          }
                        }
                      • value: "Tab"
                      • raw: "'Tab'"
                      }
                    }
                  • consequent: ReturnStatement {...}
                    • type: "ReturnStatement"
                    • start: 189
                    • end: 196
                    • loc: {...}
                      • start: {...}
                        • line: 7
                        • column: 27
                        }
                      • end: {...}
                        • line: 7
                        • column: 34
                        }
                      }
                    • argument: null
                    }
                  • alternate: null
                  }
                • ExpressionStatement {...}
                  • type: "ExpressionStatement"
                  • start: 200
                  • end: 223
                  • loc: {...}
                    • start: {...}
                      • line: 9
                      • column: 2
                      }
                    • end: {...}
                      • line: 9
                      • column: 25
                      }
                    }
                  • expression: CallExpression {...}
                    • type: "CallExpression"
                    • start: 200
                    • end: 222
                    • loc: {...}
                      • start: {...}
                        • line: 9
                        • column: 2
                        }
                      • end: {...}
                        • line: 9
                        • column: 24
                        }
                      }
                    • callee: MemberExpression {...}
                      • type: "MemberExpression"
                      • start: 200
                      • end: 220
                      • loc: {...}
                        • start: {...}
                          • line: 9
                          • column: 2
                          }
                        • end: {...}
                          • line: 9
                          • column: 22
                          }
                        }
                      • object: Identifier {...}
                        • type: "Identifier"
                        • start: 200
                        • end: 205
                        • loc: {...}
                          • start: {...}
                            • line: 9
                            • column: 2
                            }
                          • end: {...}
                            • line: 9
                            • column: 7
                            }
                          }
                        • name: "event"
                        }
                      • property: Identifier {...}
                        • type: "Identifier"
                        • start: 206
                        • end: 220
                        • loc: {...}
                          • start: {...}
                            • line: 9
                            • column: 8
                            }
                          • end: {...}
                            • line: 9
                            • column: 22
                            }
                          }
                        • name: "preventDefault"
                        }
                      • computed: false
                      • optional: false
                      }
                    • arguments: []
                    • optional: false
                    }
                  }
                • VariableDeclaration {...}
                  • type: "VariableDeclaration"
                  • start: 227
                  • end: 280
                  • loc: {...}
                    • start: {...}
                      • line: 11
                      • column: 2
                      }
                    • end: {...}
                      • line: 11
                      • column: 55
                      }
                    }
                  • declarations: [...] (1)
                    • VariableDeclarator {...}
                      • type: "VariableDeclarator"
                      • start: 233
                      • end: 279
                      • loc: {...}
                        • start: {...}
                          • line: 11
                          • column: 8
                          }
                        • end: {...}
                          • line: 11
                          • column: 54
                          }
                        }
                      • id: ObjectPattern {...}
                        • type: "ObjectPattern"
                        • start: 233
                        • end: 272
                        • loc: {...}
                          • start: {...}
                            • line: 11
                            • column: 8
                            }
                          • end: {...}
                            • line: 11
                            • column: 47
                            }
                          }
                        • properties: [...] (3)
                          • Property {...}
                            • type: "Property"
                            • start: 235
                            • end: 249
                            • loc: {...}
                              • start: {...}
                                • line: 11
                                • column: 10
                                }
                              • end: {...}
                                • line: 11
                                • column: 24
                                }
                              }
                            • method: false
                            • shorthand: true
                            • computed: false
                            • key: Identifier {...}
                              • type: "Identifier"
                              • start: 235
                              • end: 249
                              • loc: {...}
                                • start: {...}
                                  • line: 11
                                  • column: 10
                                  }
                                • end: {...}
                                  • line: 11
                                  • column: 24
                                  }
                                }
                              • name: "selectionStart"
                              }
                            • kind: "init"
                            • value: Identifier {...}
                              • type: "Identifier"
                              • start: 235
                              • end: 249
                              • loc: {...}
                                • start: {...}
                                  • line: 11
                                  • column: 10
                                  }
                                • end: {...}
                                  • line: 11
                                  • column: 24
                                  }
                                }
                              • name: "selectionStart"
                              }
                            }
                          • Property {...}
                            • type: "Property"
                            • start: 251
                            • end: 263
                            • loc: {...}
                              • start: {...}
                                • line: 11
                                • column: 26
                                }
                              • end: {...}
                                • line: 11
                                • column: 38
                                }
                              }
                            • method: false
                            • shorthand: true
                            • computed: false
                            • key: Identifier {...}
                              • type: "Identifier"
                              • start: 251
                              • end: 263
                              • loc: {...}
                                • start: {...}
                                  • line: 11
                                  • column: 26
                                  }
                                • end: {...}
                                  • line: 11
                                  • column: 38
                                  }
                                }
                              • name: "selectionEnd"
                              }
                            • kind: "init"
                            • value: Identifier {...}
                              • type: "Identifier"
                              • start: 251
                              • end: 263
                              • loc: {...}
                                • start: {...}
                                  • line: 11
                                  • column: 26
                                  }
                                • end: {...}
                                  • line: 11
                                  • column: 38
                                  }
                                }
                              • name: "selectionEnd"
                              }
                            }
                          • Property {...}
                            • type: "Property"
                            • start: 265
                            • end: 270
                            • loc: {...}
                              • start: {...}
                                • line: 11
                                • column: 40
                                }
                              • end: {...}
                                • line: 11
                                • column: 45
                                }
                              }
                            • method: false
                            • shorthand: true
                            • computed: false
                            • key: Identifier {...}
                              • type: "Identifier"
                              • start: 265
                              • end: 270
                              • loc: {...}
                                • start: {...}
                                  • line: 11
                                  • column: 40
                                  }
                                • end: {...}
                                  • line: 11
                                  • column: 45
                                  }
                                }
                              • name: "value"
                              }
                            • kind: "init"
                            • value: Identifier {...}
                              • type: "Identifier"
                              • start: 265
                              • end: 270
                              • loc: {...}
                                • start: {...}
                                  • line: 11
                                  • column: 40
                                  }
                                • end: {...}
                                  • line: 11
                                  • column: 45
                                  }
                                }
                              • name: "value"
                              }
                            }
                          ]
                        }
                      • init: ThisExpression {...}
                        • type: "ThisExpression"
                        • start: 275
                        • end: 279
                        • loc: {...}
                          • start: {...}
                            • line: 11
                            • column: 50
                            }
                          • end: {...}
                            • line: 11
                            • column: 54
                            }
                          }
                        }
                      }
                    ]
                  • kind: "const"
                  }
                • VariableDeclaration {...}
                  • type: "VariableDeclaration"
                  • start: 283
                  • end: 343
                  • loc: {...}
                    • start: {...}
                      • line: 12
                      • column: 2
                      }
                    • end: {...}
                      • line: 12
                      • column: 62
                      }
                    }
                  • declarations: [...] (1)
                    • VariableDeclarator {...}
                      • type: "VariableDeclarator"
                      • start: 289
                      • end: 342
                      • loc: {...}
                        • start: {...}
                          • line: 12
                          • column: 8
                          }
                        • end: {...}
                          • line: 12
                          • column: 61
                          }
                        }
                      • id: Identifier {...}
                        • type: "Identifier"
                        • start: 289
                        • end: 298
                        • loc: {...}
                          • start: {...}
                            • line: 12
                            • column: 8
                            }
                          • end: {...}
                            • line: 12
                            • column: 17
                            }
                          }
                        • name: "selection"
                        }
                      • init: CallExpression {...}
                        • type: "CallExpression"
                        • start: 301
                        • end: 342
                        • loc: {...}
                          • start: {...}
                            • line: 12
                            • column: 20
                            }
                          • end: {...}
                            • line: 12
                            • column: 61
                            }
                          }
                        • callee: MemberExpression {...}
                          • type: "MemberExpression"
                          • start: 301
                          • end: 312
                          • loc: {...}
                            • start: {...}
                              • line: 12
                              • column: 20
                              }
                            • end: {...}
                              • line: 12
                              • column: 31
                              }
                            }
                          • object: Identifier {...}
                            • type: "Identifier"
                            • start: 301
                            • end: 306
                            • loc: {...}
                              • start: {...}
                                • line: 12
                                • column: 20
                                }
                              • end: {...}
                                • line: 12
                                • column: 25
                                }
                              }
                            • name: "value"
                            }
                          • property: Identifier {...}
                            • type: "Identifier"
                            • start: 307
                            • end: 312
                            • loc: {...}
                              • start: {...}
                                • line: 12
                                • column: 26
                                }
                              • end: {...}
                                • line: 12
                                • column: 31
                                }
                              }
                            • name: "slice"
                            }
                          • computed: false
                          • optional: false
                          }
                        • arguments: [...] (2)
                          • Identifier {...}
                            • type: "Identifier"
                            • start: 313
                            • end: 327
                            • loc: {...}
                              • start: {...}
                                • line: 12
                                • column: 32
                                }
                              • end: {...}
                                • line: 12
                                • column: 46
                                }
                              }
                            • name: "selectionStart"
                            }
                          • Identifier {...}
                            • type: "Identifier"
                            • start: 329
                            • end: 341
                            • loc: {...}
                              • start: {...}
                                • line: 12
                                • column: 48
                                }
                              • end: {...}
                                • line: 12
                                • column: 60
                                }
                              }
                            • name: "selectionEnd"
                            }
                          ]
                        • optional: false
                        }
                      }
                    ]
                  • kind: "const"
                  }
                • VariableDeclaration {...}
                  • type: "VariableDeclaration"
                  • start: 347
                  • end: 443
                  • loc: {...}
                    • start: {...}
                      • line: 14
                      • column: 2
                      }
                    • end: {...}
                      • line: 14
                      • column: 98
                      }
                    }
                  • declarations: [...] (1)
                    • VariableDeclarator {...}
                      • type: "VariableDeclarator"
                      • start: 353
                      • end: 442
                      • loc: {...}
                        • start: {...}
                          • line: 14
                          • column: 8
                          }
                        • end: {...}
                          • line: 14
                          • column: 97
                          }
                        }
                      • id: Identifier {...}
                        • type: "Identifier"
                        • start: 353
                        • end: 364
                        • loc: {...}
                          • start: {...}
                            • line: 14
                            • column: 8
                            }
                          • end: {...}
                            • line: 14
                            • column: 19
                            }
                          }
                        • name: "replacement"
                        }
                      • init: ConditionalExpression {...}
                        • type: "ConditionalExpression"
                        • start: 367
                        • end: 442
                        • loc: {...}
                          • start: {...}
                            • line: 14
                            • column: 22
                            }
                          • end: {...}
                            • line: 14
                            • column: 97
                            }
                          }
                        • test: CallExpression {...}
                          • type: "CallExpression"
                          • start: 367
                          • end: 390
                          • loc: {...}
                            • start: {...}
                              • line: 14
                              • column: 22
                              }
                            • end: {...}
                              • line: 14
                              • column: 45
                              }
                            }
                          • callee: MemberExpression {...}
                            • type: "MemberExpression"
                            • start: 367
                            • end: 379
                            • loc: {...}
                              • start: {...}
                                • line: 14
                                • column: 22
                                }
                              • end: {...}
                                • line: 14
                                • column: 34
                                }
                              }
                            • object: Literal {...}
                              • type: "Literal"
                              • start: 367
                              • end: 374
                              • loc: {...}
                                • start: {...}
                                  • line: 14
                                  • column: 22
                                  }
                                • end: {...}
                                  • line: 14
                                  • column: 29
                                  }
                                }
                              • value: {...}
                                  }
                                • raw: "/[a-z]/"
                                • regex: {...}
                                  • pattern: "[a-z]"
                                  • flags: ""
                                  }
                                }
                              • property: Identifier {...}
                                • type: "Identifier"
                                • start: 375
                                • end: 379
                                • loc: {...}
                                  • start: {...}
                                    • line: 14
                                    • column: 30
                                    }
                                  • end: {...}
                                    • line: 14
                                    • column: 34
                                    }
                                  }
                                • name: "test"
                                }
                              • computed: false
                              • optional: false
                              }
                            • arguments: [...] (1)
                              • Identifier {...}
                                • type: "Identifier"
                                • start: 380
                                • end: 389
                                • loc: {...}
                                  • start: {...}
                                    • line: 14
                                    • column: 35
                                    }
                                  • end: {...}
                                    • line: 14
                                    • column: 44
                                    }
                                  }
                                • name: "selection"
                                }
                              ]
                            • optional: false
                            }
                          • consequent: CallExpression {...}
                            • type: "CallExpression"
                            • start: 393
                            • end: 416
                            • loc: {...}
                              • start: {...}
                                • line: 14
                                • column: 48
                                }
                              • end: {...}
                                • line: 14
                                • column: 71
                                }
                              }
                            • callee: MemberExpression {...}
                              • type: "MemberExpression"
                              • start: 393
                              • end: 414
                              • loc: {...}
                                • start: {...}
                                  • line: 14
                                  • column: 48
                                  }
                                • end: {...}
                                  • line: 14
                                  • column: 69
                                  }
                                }
                              • object: Identifier {...}
                                • type: "Identifier"
                                • start: 393
                                • end: 402
                                • loc: {...}
                                  • start: {...}
                                    • line: 14
                                    • column: 48
                                    }
                                  • end: {...}
                                    • line: 14
                                    • column: 57
                                    }
                                  }
                                • name: "selection"
                                }
                              • property: Identifier {...}
                                • type: "Identifier"
                                • start: 403
                                • end: 414
                                • loc: {...}
                                  • start: {...}
                                    • line: 14
                                    • column: 58
                                    }
                                  • end: {...}
                                    • line: 14
                                    • column: 69
                                    }
                                  }
                                • name: "toUpperCase"
                                }
                              • computed: false
                              • optional: false
                              }
                            • arguments: []
                            • optional: false
                            }
                          • alternate: CallExpression {...}
                            • type: "CallExpression"
                            • start: 419
                            • end: 442
                            • loc: {...}
                              • start: {...}
                                • line: 14
                                • column: 74
                                }
                              • end: {...}
                                • line: 14
                                • column: 97
                                }
                              }
                            • callee: MemberExpression {...}
                              • type: "MemberExpression"
                              • start: 419
                              • end: 440
                              • loc: {...}
                                • start: {...}
                                  • line: 14
                                  • column: 74
                                  }
                                • end: {...}
                                  • line: 14
                                  • column: 95
                                  }
                                }
                              • object: Identifier {...}
                                • type: "Identifier"
                                • start: 419
                                • end: 428
                                • loc: {...}
                                  • start: {...}
                                    • line: 14
                                    • column: 74
                                    }
                                  • end: {...}
                                    • line: 14
                                    • column: 83
                                    }
                                  }
                                • name: "selection"
                                }
                              • property: Identifier {...}
                                • type: "Identifier"
                                • start: 429
                                • end: 440
                                • loc: {...}
                                  • start: {...}
                                    • line: 14
                                    • column: 84
                                    }
                                  • end: {...}
                                    • line: 14
                                    • column: 95
                                    }
                                  }
                                • name: "toLowerCase"
                                }
                              • computed: false
                              • optional: false
                              }
                            • arguments: []
                            • optional: false
                            }
                          }
                        }
                      ]
                    • kind: "const"
                    }
                  • ExpressionStatement {...}
                    • type: "ExpressionStatement"
                    • start: 447
                    • end: 527
                    • loc: {...}
                      • start: {...}
                        • line: 16
                        • column: 2
                        }
                      • end: {...}
                        • line: 16
                        • column: 82
                        }
                      }
                    • expression: AssignmentExpression {...}
                      • type: "AssignmentExpression"
                      • start: 447
                      • end: 526
                      • loc: {...}
                        • start: {...}
                          • line: 16
                          • column: 2
                          }
                        • end: {...}
                          • line: 16
                          • column: 81
                          }
                        }
                      • operator: "="
                      • left: Identifier {...}
                        • type: "Identifier"
                        • start: 447
                        • end: 451
                        • loc: {...}
                          • start: {...}
                            • line: 16
                            • column: 2
                            }
                          • end: {...}
                            • line: 16
                            • column: 6
                            }
                          }
                        • name: "text"
                        }
                      • right: BinaryExpression {...}
                        • type: "BinaryExpression"
                        • start: 454
                        • end: 526
                        • loc: {...}
                          • start: {...}
                            • line: 16
                            • column: 9
                            }
                          • end: {...}
                            • line: 16
                            • column: 81
                            }
                          }
                        • left: BinaryExpression {...}
                          • type: "BinaryExpression"
                          • start: 454
                          • end: 498
                          • loc: {...}
                            • start: {...}
                              • line: 16
                              • column: 9
                              }
                            • end: {...}
                              • line: 16
                              • column: 53
                              }
                            }
                          • left: CallExpression {...}
                            • type: "CallExpression"
                            • start: 454
                            • end: 484
                            • loc: {...}
                              • start: {...}
                                • line: 16
                                • column: 9
                                }
                              • end: {...}
                                • line: 16
                                • column: 39
                                }
                              }
                            • callee: MemberExpression {...}
                              • type: "MemberExpression"
                              • start: 454
                              • end: 465
                              • loc: {...}
                                • start: {...}
                                  • line: 16
                                  • column: 9
                                  }
                                • end: {...}
                                  • line: 16
                                  • column: 20
                                  }
                                }
                              • object: Identifier {...}
                                • type: "Identifier"
                                • start: 454
                                • end: 459
                                • loc: {...}
                                  • start: {...}
                                    • line: 16
                                    • column: 9
                                    }
                                  • end: {...}
                                    • line: 16
                                    • column: 14
                                    }
                                  }
                                • name: "value"
                                }
                              • property: Identifier {...}
                                • type: "Identifier"
                                • start: 460
                                • end: 465
                                • loc: {...}
                                  • start: {...}
                                    • line: 16
                                    • column: 15
                                    }
                                  • end: {...}
                                    • line: 16
                                    • column: 20
                                    }
                                  }
                                • name: "slice"
                                }
                              • computed: false
                              • optional: false
                              }
                            • arguments: [...] (2)
                              • Literal {...}
                                • type: "Literal"
                                • start: 466
                                • end: 467
                                • loc: {...}
                                  • start: {...}
                                    • line: 16
                                    • column: 21
                                    }
                                  • end: {...}
                                    • line: 16
                                    • column: 22
                                    }
                                  }
                                • value: 0
                                • raw: "0"
                                }
                              • Identifier {...}
                                • type: "Identifier"
                                • start: 469
                                • end: 483
                                • loc: {...}
                                  • start: {...}
                                    • line: 16
                                    • column: 24
                                    }
                                  • end: {...}
                                    • line: 16
                                    • column: 38
                                    }
                                  }
                                • name: "selectionStart"
                                }
                              ]
                            • optional: false
                            }
                          • operator: "+"
                          • right: Identifier {...}
                            • type: "Identifier"
                            • start: 487
                            • end: 498
                            • loc: {...}
                              • start: {...}
                                • line: 16
                                • column: 42
                                }
                              • end: {...}
                                • line: 16
                                • column: 53
                                }
                              }
                            • name: "replacement"
                            }
                          }
                        • operator: "+"
                        • right: CallExpression {...}
                          • type: "CallExpression"
                          • start: 501
                          • end: 526
                          • loc: {...}
                            • start: {...}
                              • line: 16
                              • column: 56
                              }
                            • end: {...}
                              • line: 16
                              • column: 81
                              }
                            }
                          • callee: MemberExpression {...}
                            • type: "MemberExpression"
                            • start: 501
                            • end: 512
                            • loc: {...}
                              • start: {...}
                                • line: 16
                                • column: 56
                                }
                              • end: {...}
                                • line: 16
                                • column: 67
                                }
                              }
                            • object: Identifier {...}
                              • type: "Identifier"
                              • start: 501
                              • end: 506
                              • loc: {...}
                                • start: {...}
                                  • line: 16
                                  • column: 56
                                  }
                                • end: {...}
                                  • line: 16
                                  • column: 61
                                  }
                                }
                              • name: "value"
                              }
                            • property: Identifier {...}
                              • type: "Identifier"
                              • start: 507
                              • end: 512
                              • loc: {...}
                                • start: {...}
                                  • line: 16
                                  • column: 62
                                  }
                                • end: {...}
                                  • line: 16
                                  • column: 67
                                  }
                                }
                              • name: "slice"
                              }
                            • computed: false
                            • optional: false
                            }
                          • arguments: [...] (1)
                            • Identifier {...}
                              • type: "Identifier"
                              • start: 513
                              • end: 525
                              • loc: {...}
                                • start: {...}
                                  • line: 16
                                  • column: 68
                                  }
                                • end: {...}
                                  • line: 16
                                  • column: 80
                                  }
                                }
                              • name: "selectionEnd"
                              }
                            ]
                          • optional: false
                          }
                        }
                      }
                    }
                  • ExpressionStatement {...}
                    • type: "ExpressionStatement"
                    • start: 531
                    • end: 544
                    • loc: {...}
                      • start: {...}
                        • line: 18
                        • column: 2
                        }
                      • end: {...}
                        • line: 18
                        • column: 15
                        }
                      }
                    • expression: AwaitExpression {...}
                      • type: "AwaitExpression"
                      • start: 531
                      • end: 543
                      • loc: {...}
                        • start: {...}
                          • line: 18
                          • column: 2
                          }
                        • end: {...}
                          • line: 18
                          • column: 14
                          }
                        }
                      • argument: CallExpression {...}
                        • type: "CallExpression"
                        • start: 537
                        • end: 543
                        • loc: {...}
                          • start: {...}
                            • line: 18
                            • column: 8
                            }
                          • end: {...}
                            • line: 18
                            • column: 14
                            }
                          }
                        • callee: Identifier {...}
                          • type: "Identifier"
                          • start: 537
                          • end: 541
                          • loc: {...}
                            • start: {...}
                              • line: 18
                              • column: 8
                              }
                            • end: {...}
                              • line: 18
                              • column: 12
                              }
                            }
                          • name: "tick"
                          }
                        • arguments: []
                        • optional: false
                        }
                      }
                    }
                  • ExpressionStatement {...}
                    • type: "ExpressionStatement"
                    • start: 547
                    • end: 584
                    • loc: {...}
                      • start: {...}
                        • line: 19
                        • column: 2
                        }
                      • end: {...}
                        • line: 19
                        • column: 39
                        }
                      }
                    • expression: AssignmentExpression {...}
                      • type: "AssignmentExpression"
                      • start: 547
                      • end: 583
                      • loc: {...}
                        • start: {...}
                          • line: 19
                          • column: 2
                          }
                        • end: {...}
                          • line: 19
                          • column: 38
                          }
                        }
                      • operator: "="
                      • left: MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 547
                        • end: 566
                        • loc: {...}
                          • start: {...}
                            • line: 19
                            • column: 2
                            }
                          • end: {...}
                            • line: 19
                            • column: 21
                            }
                          }
                        • object: ThisExpression {...}
                          • type: "ThisExpression"
                          • start: 547
                          • end: 551
                          • loc: {...}
                            • start: {...}
                              • line: 19
                              • column: 2
                              }
                            • end: {...}
                              • line: 19
                              • column: 6
                              }
                            }
                          }
                        • property: Identifier {...}
                          • type: "Identifier"
                          • start: 552
                          • end: 566
                          • loc: {...}
                            • start: {...}
                              • line: 19
                              • column: 7
                              }
                            • end: {...}
                              • line: 19
                              • column: 21
                              }
                            }
                          • name: "selectionStart"
                          }
                        • computed: false
                        • optional: false
                        }
                      • right: Identifier {...}
                        • type: "Identifier"
                        • start: 569
                        • end: 583
                        • loc: {...}
                          • start: {...}
                            • line: 19
                            • column: 24
                            }
                          • end: {...}
                            • line: 19
                            • column: 38
                            }
                          }
                        • name: "selectionStart"
                        }
                      }
                    }
                  • ExpressionStatement {...}
                    • type: "ExpressionStatement"
                    • start: 587
                    • end: 620
                    • loc: {...}
                      • start: {...}
                        • line: 20
                        • column: 2
                        }
                      • end: {...}
                        • line: 20
                        • column: 35
                        }
                      }
                    • expression: AssignmentExpression {...}
                      • type: "AssignmentExpression"
                      • start: 587
                      • end: 619
                      • loc: {...}
                        • start: {...}
                          • line: 20
                          • column: 2
                          }
                        • end: {...}
                          • line: 20
                          • column: 34
                          }
                        }
                      • operator: "="
                      • left: MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 587
                        • end: 604
                        • loc: {...}
                          • start: {...}
                            • line: 20
                            • column: 2
                            }
                          • end: {...}
                            • line: 20
                            • column: 19
                            }
                          }
                        • object: ThisExpression {...}
                          • type: "ThisExpression"
                          • start: 587
                          • end: 591
                          • loc: {...}
                            • start: {...}
                              • line: 20
                              • column: 2
                              }
                            • end: {...}
                              • line: 20
                              • column: 6
                              }
                            }
                          }
                        • property: Identifier {...}
                          • type: "Identifier"
                          • start: 592
                          • end: 604
                          • loc: {...}
                            • start: {...}
                              • line: 20
                              • column: 7
                              }
                            • end: {...}
                              • line: 20
                              • column: 19
                              }
                            }
                          • name: "selectionEnd"
                          }
                        • computed: false
                        • optional: false
                        }
                      • right: Identifier {...}
                        • type: "Identifier"
                        • start: 607
                        • end: 619
                        • loc: {...}
                          • start: {...}
                            • line: 20
                            • column: 22
                            }
                          • end: {...}
                            • line: 20
                            • column: 34
                            }
                          }
                        • name: "selectionEnd"
                        }
                      }
                    }
                  ]
                }
              }
            ]
          • sourceType: "module"
          }
        • attributes: []
        }
      }
    The AST is not public API and may change at any point in time
    tick • Playground • Svelte