code: function initial_mode(t, value, arg3, arg4) {
      switch(t) {
      case 1: // TEXT
        value = value.replace(LEADINGWS, ""); // Ignore spaces
        if (value.length === 0) return; // Are we done?
        break; // Handle anything non-space text below
      case 4: // COMMENT
        doc._appendChild(doc.createComment(value));
        return;
      case 5: // DOCTYPE
        var name = value;
        var publicid = arg3;
        var systemid = arg4;
        // Use the constructor directly instead of
        // implementation.createDocumentType because the create
        // function throws errors on invalid characters, and
        // we don't want the parser to throw them.
        doc.appendChild(new DocumentType(doc, name, publicid, systemid));
  
        // Note that there is no public API for setting quirks mode We can
        // do this here because we have access to implementation details
        if (force_quirks ||
          name.toLowerCase() !== "html" ||
          quirkyPublicIds.test(publicid) ||
          (systemid && systemid.toLowerCase() === quirkySystemId) ||
          (systemid === undefined &&
           conditionallyQuirkyPublicIds.test(publicid)))
          doc._quirks = true;
        else if (limitedQuirkyPublicIds.test(publicid) ||
             (systemid !== undefined &&
              conditionallyQuirkyPublicIds.test(publicid)))
          doc._limitedQuirks = true;
        parser = before_html_mode;
        return;
      }
  
      // tags or non-whitespace text
      doc._quirks = true;
      parser = before_html_mode;
      parser(t,value,arg3,arg4);
    }
docs: *
  The tree builder insertion modes
   11.2.5.4.1 The "initial" insertion mode