* Goal of the optimizer: walk the generated template AST tree * and detect sub-trees that are purely static, i.e. parts of * the DOM that never needs to change. * * Once we detect these sub-trees, we can: * * 1. Hoist them into constants, so that we no longer need to * create fresh nodes f
(root, options)
| 8239 | * 2. Completely skip them in the patching process. |
| 8240 | */ |
| 8241 | function optimize (root, options) { |
| 8242 | if (!root) { return } |
| 8243 | isStaticKey = genStaticKeysCached(options.staticKeys || ''); |
| 8244 | isPlatformReservedTag = options.isReservedTag || no; |
| 8245 | // first pass: mark all non-static nodes. |
| 8246 | markStatic$1(root); |
| 8247 | // second pass: mark static roots. |
| 8248 | markStaticRoots(root, false); |
| 8249 | } |
| 8250 | |
| 8251 | function genStaticKeys$1 (keys) { |
| 8252 | return makeMap( |
no test coverage detected