     content && el.appendChild(content)
     el
 
-  onReady = ->
+  whenHasBody = ->
     # Add styles
     style_tag = mkEl 'style', null, document.createTextNode(style_code)
     document.getElementsByTagName('head')[0].appendChild style_tag

    jslib_jail_doc.documentElement.appendChild(script_tag)

    root = jslib_jail_iframe.contentWindow.FactlinkJailRoot
    root.perf.add_existing_timing_event 'factlink_loader_start', factlink_loader_start_timestamp
    root.perf.add_existing_timing_event 'before_jail', load_time_before_jail
    root.perf.add_timing_event 'after_jail'

    root.core_loaded_promise.done ->
      #called from jail-iframe when core iframe is ready.
      for name in methods
        do (name) ->

    # Wrapper for increased CSS specificity
    outerWrapperEl = mkEl 'div', 'factlink-containment-wrapper', jslib_jail_iframe

    document.body.insertBefore(outerWrapperEl, document.body.firstChild)

    load_time_before_jail = new Date().getTime()

