JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id="log"></div>
</body>
JavaScript
// jQuery bug
// $.fn.clearQueue won't kill any timeouts created via .delay() which will dequeue the next element from the queue when they timeout.
// Expected: "Start" - (5000ms delay) - "End"
// Got: "Start" - ( 250ms delay) - "End"
$(function() {
$("#log")
.html("Start: " + $.now() + "<br>")
.delay(250)
.queue(function() {
$("#log").append("Never Printed!");
});
// we need jQuery to start working on the queue
// (i.e. executing delay(250))
setTimeout(
function(){
$("#log")
.clearQueue()
.delay(5000)
.queue(function() {
$("#log").append("End: " + $.now());
});
}, 0);
});