HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/nodejs/turbolinks/src/turbolinks/error_renderer.js
// Generated by CoffeeScript 1.12.8
(function() {
  var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    hasProp = {}.hasOwnProperty;

  require('./renderer');

  Turbolinks.ErrorRenderer = (function(superClass) {
    extend(ErrorRenderer, superClass);

    function ErrorRenderer(html) {
      var htmlElement;
      htmlElement = document.createElement("html");
      htmlElement.innerHTML = html;
      this.newHead = htmlElement.querySelector("head");
      this.newBody = htmlElement.querySelector("body");
    }

    ErrorRenderer.prototype.render = function(callback) {
      return this.renderView((function(_this) {
        return function() {
          _this.replaceHeadAndBody();
          _this.activateBodyScriptElements();
          return callback();
        };
      })(this));
    };

    ErrorRenderer.prototype.replaceHeadAndBody = function() {
      var body, head;
      head = document.head, body = document.body;
      head.parentNode.replaceChild(this.newHead, head);
      return body.parentNode.replaceChild(this.newBody, body);
    };

    ErrorRenderer.prototype.activateBodyScriptElements = function() {
      var element, i, len, ref, replaceableElement, results;
      ref = this.getScriptElements();
      results = [];
      for (i = 0, len = ref.length; i < len; i++) {
        replaceableElement = ref[i];
        element = this.createScriptElement(replaceableElement);
        results.push(replaceableElement.parentNode.replaceChild(element, replaceableElement));
      }
      return results;
    };

    ErrorRenderer.prototype.getScriptElements = function() {
      return document.documentElement.querySelectorAll("script");
    };

    return ErrorRenderer;

  })(Turbolinks.Renderer);

}).call(this);