This can be easily seen by using <body data-instant-intensity="1000"> - when hovering over multiple links, despite having un-hovered them, they are still preloaded after one second.
Potential solution
Instead of using a variable which only stores one timeout ID at a time, the script should use an Object/a Map to keep track of the URLs having a timeout, and the timeout ID for clearing it.
To me, https://instant.page/intensity#:~:text=Adjusting%20the%20delay%20on%20hover isn't really clear what exactly adjusting the value does.
I'd assume that if a user hovers over a link, but un-hovers within the specified time in milliseconds, nothing would get preloaded.
However, this isn't the case when hovering over multiple links within a short time, or re-hovering over the same link again. https://github.com/instantpage/instant.page/blob/3525715c22373886567c3f62faf5a00e4380b566/instantpage.js#L201 causes the variable to be overwritten while it may still be needed for a different link.
Because the timeout ID was overwritten, clearing it has no effect if more than one link has been hovered over within the configured time: https://github.com/instantpage/instant.page/blob/3525715c22373886567c3f62faf5a00e4380b566/instantpage.js#L223
Reproduction
This can be easily seen by using
<body data-instant-intensity="1000">
- when hovering over multiple links, despite having un-hovered them, they are still preloaded after one second.Potential solution
Instead of using a variable which only stores one timeout ID at a time, the script should use an Object/a Map to keep track of the URLs having a timeout, and the timeout ID for clearing it.