.spaced-li.left.mlm[
- The page is the module
- Js code scoped to the page
- Less code to write
- Start from clean slate when page change
## Three additional rules
]
---
class: middle
# 1. Keep the DOM tree, do not re-render
.dflex.p-m0[.noop[
- Reuse, rearrange the nodes
- Keep references to the nodes
- Use the DOM API
- Element.insertAdjacentElement()
- Element.insertAdjacentHTML()
- Element.append()
- Element.moveBefore()
- …
]]
---
class: middle, evt-delg
# 2. Delegate events
## Listen to the top level element
.dflex[.noop[
```html