Commit 03bd4f4
committed
perf: skip redundant render-root and title writes on no-op ticks
The shared dateObserver ticks every registered <relative-time> on a single timer, calling update() on each. update() unconditionally rebuilt the [part=root] span via replaceChildren and re-set the title attribute even when the computed text/title were identical to what was already rendered (common on periodic ticks, e.g. an item that still reads "3mo").
Guard #updateRenderRootContent to reuse the existing span when the content and aria-hidden state are unchanged, and skip setAttribute('title') when the title is unchanged. This avoids needless DOM churn and style invalidation on every no-op tick.1 parent c69538b commit 03bd4f4
2 files changed
Lines changed: 49 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
367 | 382 | | |
368 | 383 | | |
369 | | - | |
| 384 | + | |
370 | 385 | | |
371 | 386 | | |
372 | 387 | | |
373 | | - | |
| 388 | + | |
374 | 389 | | |
375 | 390 | | |
376 | 391 | | |
| |||
626 | 641 | | |
627 | 642 | | |
628 | 643 | | |
629 | | - | |
| 644 | + | |
630 | 645 | | |
631 | 646 | | |
632 | 647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
112 | 143 | | |
113 | 144 | | |
114 | 145 | | |
| |||
0 commit comments