Attaching a function directly to `onX` properties seems sloppy, but that's just a nit. Can you use `.on()` here or at least `addEventListener`?