listener = function() {
        if (hasFired) {
          return;
        }
        hasFired = true;
        doc.removeEventListener('DOMContentLoaded', listener, false);
        doc.removeEventListener('load', listener, false);
        callback.call(opt_scope);
      }
Calls a function when the DOM is ready.
The callback may be issued immediately if the DOM is already ready.
@param {!Function} callback Function to call.
@param {Object=} opt_scope Scope to call the function in.
@param {Document=} opt_document Document, if not the current one.