As luck would have it, right after I wrote about synchronous vs. asynchronous event handlers, I found exactly that problem in by bililiteRange
code. It uses dispatchEvent
to fire an input
event when text is inserted, but that fires synchronously, so that the event handlers run before the bililiteRange.text()
has fully run. I ended up having to wrap the dispatchEvent
in a setTimeout
to force it to be asynchronous.
The bililiteRange.js
code is now at version 1.7.