Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Stop skipping ages as they change unit
getElementsByClassName returns a live collection, so an age moved to
the next unit dropped out of it mid-loop and the age after it was
skipped until the next pass, which can be a day away. On a cached page
that has crossed a unit boundary every second age stayed stale.
querySelectorAll returns a static list of the same elements.
Diffstat (limited to '')
| -rw-r--r-- | assets/cgit.js | 2 |
1 file changed, 1 insertion, 1 deletion
diff --git a/assets/cgit.js b/assets/cgit.js index 90f06c0..d09423f 100644 --- a/assets/cgit.js +++ b/assets/cgit.js @@ -67,7 +67,7 @@ function update_ages() { var now = Math.round(new Date().getTime() / 1000); for (bucket = 0; bucket < age_classes.length; bucket++) { - elements = document.getElementsByClassName(age_classes[bucket]); + elements = document.querySelectorAll("." + age_classes[bucket]); if (elements.length && update_delay[bucket] < delay) delay = update_delay[bucket]; |
