This afternoon I revisited some old code I wrote to address the problem where sometimes you want to do the following:


Even though that’s perfectly acceptable within JS, it takes time for the browser rendering engine to do the job of actually inserting the DOM, so it may not be ready for the second line to actually find the content it just inserted. I outlined the whole problem in an old post here.

Anyway, I updated the code in that post and rewrote it into a requireJS module. You can find it here: It’ll be included in the upcoming Data Generator rewrite.