```coffeescript
#= require ./renderer

class Turbolinks.ErrorRenderer extends Turbolinks.Renderer
  constructor: (@html) ->

  render: (callback) ->
    @renderView =>
      @replaceDocumentHTML()
      @activateBodyScriptElements()
      callback()

  replaceDocumentHTML: ->
    document.documentElement.innerHTML = @html

  activateBodyScriptElements: ->
    for replaceableElement in @getScriptElements()
      element = @createScriptElement(replaceableElement)
      replaceableElement.parentNode.replaceChild(element, replaceableElement)

  getScriptElements: ->
    document.documentElement.querySelectorAll("script")
```

Set newBody property when rendering errors
user
```coffeescript
#= require ./renderer

class Turbolinks.ErrorRenderer extends Turbolinks.Renderer
  constructor: (html) ->
    htmlElement = document.createElement("html")
    htmlElement.innerHTML = html
    @newHead = htmlElement.querySelector("head")
    @newBody = htmlElement.querySelector("body")

  render: (callback) ->
    @renderView =>
      @replaceHeadAndBody()
      @activateBodyScriptElements()
      callback()

  replaceHeadAndBody: ->
    {head, body} = document
    head.parentNode.replaceChild(@newHead, head)
    body.parentNode.replaceChild(@newBody, body)

  activateBodyScriptElements: ->
    for replaceableElement in @getScriptElements()
      element = @createScriptElement(replaceableElement)
      replaceableElement.parentNode.replaceChild(element, replaceableElement)

  getScriptElements: ->
    document.documentElement.querySelectorAll("script")
```
assistant