defer(arg...) -> Number

Schedules the function to run as soon as the interpreter is idle.

A “deferred” function will not run immediately; rather, it will run as soon as the interpreter’s call stack is empty.

Behaves much like window.setTimeout with a delay set to 0. Returns an ID that can be used to clear the timeout with window.clearTimeout before it runs.


function hideNewElement() {

function insertThenHide(markup) {

  // IE needs a moment to add the new markup
  // to the DOM tree

insertThenHide("<div id='inserted'>Lorem ipsum</div>");