If you've done any dynamic manipulation of web pages, especially with AJAX or any other kind of web magic in the mix, you've run into IE's dreaded "Operation Aborted" error.
Here are some official comments on the issue:
The blog post says that if you aren't meeting all 3 conditions, you're OK. In my case, I believe I wasn't meeting the 3 conditions, and yet the problem persisted. It was very hard to reproduce, too. I had to have the offending website in the "Internet Zone" and experience some network lag to make it happen.
In the end, I found that if I replaced this line:
document.body.appendChild(element);
With this one:
document.body.insertAdjacentElement('afterBegin', element);
Everything worked fine. Of course, this trick works only if you're inserting a node whose position isn't important, e.g. it's a div you're going to give an absolute position anyway.
Along the way I had tried wrapping the appendChild calls in a try/catch block, but unfortunatley the append would work fine, and then IE would complain with "Operation Aborted" only after the JavaScript finished. I was hoping for a global exception handler to trap the problem, but fortunately insertAdjacentElement fixes the issue!