{"tests": [ {"description": "html start-tag followed by text, with attributes", "input": [["StartTag", "html", {"lang": "en"}], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "html start-tag followed by comment", "input": [["StartTag", "html", {}], ["Comment", "foo"]], "expected": [""] }, {"description": "html start-tag followed by space character", "input": [["StartTag", "html", {}], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "html start-tag followed by text", "input": [["StartTag", "html", {}], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "html start-tag followed by start-tag", "input": [["StartTag", "html", {}], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "html start-tag followed by end-tag", "input": [["StartTag", "html", {}], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "html start-tag at EOF (shouldn't ever happen?!)", "input": [["StartTag", "html", {}]], "expected": [""] }, {"description": "html end-tag followed by comment", "input": [["EndTag", "html"], ["Comment", "foo"]], "expected": [""] }, {"description": "html end-tag followed by space character", "input": [["EndTag", "html"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "html end-tag followed by text", "input": [["EndTag", "html"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "html end-tag followed by start-tag", "input": [["EndTag", "html"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "html end-tag followed by end-tag", "input": [["EndTag", "html"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "html end-tag at EOF", "input": [["EndTag", "html"]], "expected": [""] }, {"description": "head start-tag followed by comment", "input": [["StartTag", "head", {}], ["Comment", "foo"]], "expected": [""] }, {"description": "head start-tag followed by space character", "input": [["StartTag", "head", {}], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "head start-tag followed by text", "input": [["StartTag", "head", {}], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "head start-tag followed by start-tag", "input": [["StartTag", "head", {}], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "head start-tag followed by end-tag", "input": [["StartTag", "head", {}], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "head start-tag at EOF (shouldn't ever happen?!)", "input": [["StartTag", "head", {}]], "expected": [""] }, {"description": "head end-tag followed by comment", "input": [["EndTag", "head"], ["Comment", "foo"]], "expected": [""] }, {"description": "head end-tag followed by space character", "input": [["EndTag", "head"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "head end-tag followed by text", "input": [["EndTag", "head"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "head end-tag followed by start-tag", "input": [["EndTag", "head"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "head end-tag followed by end-tag", "input": [["EndTag", "head"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "head end-tag at EOF", "input": [["EndTag", "head"]], "expected": [""] }, {"description": "body start-tag followed by comment", "input": [["StartTag", "body", {}], ["Comment", "foo"]], "expected": [""] }, {"description": "body start-tag followed by space character", "input": [["StartTag", "body", {}], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "body start-tag followed by text", "input": [["StartTag", "body", {}], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "body start-tag followed by start-tag", "input": [["StartTag", "body", {}], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "body start-tag followed by end-tag", "input": [["StartTag", "body", {}], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "body start-tag at EOF (shouldn't ever happen?!)", "input": [["StartTag", "body", {}]], "expected": [""] }, {"description": "body end-tag followed by comment", "input": [["EndTag", "body"], ["Comment", "foo"]], "expected": [""] }, {"description": "body end-tag followed by space character", "input": [["EndTag", "body"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "body end-tag followed by text", "input": [["EndTag", "body"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "body end-tag followed by start-tag", "input": [["EndTag", "body"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "body end-tag followed by end-tag", "input": [["EndTag", "body"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "body end-tag at EOF", "input": [["EndTag", "body"]], "expected": [""] }, {"description": "li end-tag followed by comment", "input": [["EndTag", "li"], ["Comment", "foo"]], "expected": [""] }, {"description": "li end-tag followed by space character", "input": [["EndTag", "li"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "li end-tag followed by text", "input": [["EndTag", "li"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "li end-tag followed by start-tag", "input": [["EndTag", "li"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "li end-tag followed by li start-tag", "input": [["EndTag", "li"], ["StartTag", "li", {}]], "expected": ["
  • "] }, {"description": "li end-tag followed by end-tag", "input": [["EndTag", "li"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "li end-tag at EOF", "input": [["EndTag", "li"]], "expected": [""] }, {"description": "dt end-tag followed by comment", "input": [["EndTag", "dt"], ["Comment", "foo"]], "expected": [""] }, {"description": "dt end-tag followed by space character", "input": [["EndTag", "dt"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "dt end-tag followed by text", "input": [["EndTag", "dt"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "dt end-tag followed by start-tag", "input": [["EndTag", "dt"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "dt end-tag followed by dt start-tag", "input": [["EndTag", "dt"], ["StartTag", "dt", {}]], "expected": ["
    "] }, {"description": "dt end-tag followed by dd start-tag", "input": [["EndTag", "dt"], ["StartTag", "dd", {}]], "expected": ["
    "] }, {"description": "dt end-tag followed by end-tag", "input": [["EndTag", "dt"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "dt end-tag at EOF", "input": [["EndTag", "dt"]], "expected": [""] }, {"description": "dd end-tag followed by comment", "input": [["EndTag", "dd"], ["Comment", "foo"]], "expected": ["
    "] }, {"description": "dd end-tag followed by space character", "input": [["EndTag", "dd"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "dd end-tag followed by text", "input": [["EndTag", "dd"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "dd end-tag followed by start-tag", "input": [["EndTag", "dd"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "dd end-tag followed by dd start-tag", "input": [["EndTag", "dd"], ["StartTag", "dd", {}]], "expected": ["
    "] }, {"description": "dd end-tag followed by dt start-tag", "input": [["EndTag", "dd"], ["StartTag", "dt", {}]], "expected": ["
    "] }, {"description": "dd end-tag followed by end-tag", "input": [["EndTag", "dd"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "dd end-tag at EOF", "input": [["EndTag", "dd"]], "expected": [""] }, {"description": "p end-tag followed by comment", "input": [["EndTag", "p"], ["Comment", "foo"]], "expected": ["

    "] }, {"description": "p end-tag followed by space character", "input": [["EndTag", "p"], ["Characters", " foo"]], "expected": ["

    foo"] }, {"description": "p end-tag followed by text", "input": [["EndTag", "p"], ["Characters", "foo"]], "expected": ["

    foo"] }, {"description": "p end-tag followed by start-tag", "input": [["EndTag", "p"], ["StartTag", "foo", {}]], "expected": ["

    "] }, {"description": "p end-tag followed by address start-tag", "input": [["EndTag", "p"], ["StartTag", "address", {}]], "expected": ["
    "] }, {"description": "p end-tag followed by blockquote start-tag", "input": [["EndTag", "p"], ["StartTag", "blockquote", {}]], "expected": ["
    "] }, {"description": "p end-tag followed by dl start-tag", "input": [["EndTag", "p"], ["StartTag", "dl", {}]], "expected": ["
    "] }, {"description": "p end-tag followed by fieldset start-tag", "input": [["EndTag", "p"], ["StartTag", "fieldset", {}]], "expected": ["
    "] }, {"description": "p end-tag followed by form start-tag", "input": [["EndTag", "p"], ["StartTag", "form", {}]], "expected": ["
    "] }, {"description": "p end-tag followed by h1 start-tag", "input": [["EndTag", "p"], ["StartTag", "h1", {}]], "expected": ["

    "] }, {"description": "p end-tag followed by h2 start-tag", "input": [["EndTag", "p"], ["StartTag", "h2", {}]], "expected": ["

    "] }, {"description": "p end-tag followed by h3 start-tag", "input": [["EndTag", "p"], ["StartTag", "h3", {}]], "expected": ["

    "] }, {"description": "p end-tag followed by h4 start-tag", "input": [["EndTag", "p"], ["StartTag", "h4", {}]], "expected": ["

    "] }, {"description": "p end-tag followed by h5 start-tag", "input": [["EndTag", "p"], ["StartTag", "h5", {}]], "expected": ["

    "] }, {"description": "p end-tag followed by h6 start-tag", "input": [["EndTag", "p"], ["StartTag", "h6", {}]], "expected": ["
    "] }, {"description": "p end-tag followed by hr start-tag", "input": [["EndTag", "p"], ["StartTag", "hr", {}]], "expected": ["
    "] }, {"description": "p end-tag followed by menu start-tag", "input": [["EndTag", "p"], ["StartTag", "menu", {}]], "expected": [""] }, {"description": "p end-tag followed by ol start-tag", "input": [["EndTag", "p"], ["StartTag", "ol", {}]], "expected": ["
      "] }, {"description": "p end-tag followed by p start-tag", "input": [["EndTag", "p"], ["StartTag", "p", {}]], "expected": ["

      "] }, {"description": "p end-tag followed by pre start-tag", "input": [["EndTag", "p"], ["StartTag", "pre", {}]], "expected": ["

      "]
      },
      
      {"description": "p end-tag followed by table start-tag",
       "input": [["EndTag", "p"], ["StartTag", "table", {}]],
       "expected": [""]
      },
      
      {"description": "p end-tag followed by ul start-tag",
       "input": [["EndTag", "p"], ["StartTag", "ul", {}]],
       "expected": ["
        "] }, {"description": "p end-tag followed by end-tag", "input": [["EndTag", "p"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "p end-tag at EOF", "input": [["EndTag", "p"]], "expected": [""] }, {"description": "optgroup end-tag followed by comment", "input": [["EndTag", "optgroup"], ["Comment", "foo"]], "expected": [""] }, {"description": "optgroup end-tag followed by space character", "input": [["EndTag", "optgroup"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "optgroup end-tag followed by text", "input": [["EndTag", "optgroup"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "optgroup end-tag followed by start-tag", "input": [["EndTag", "optgroup"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "optgroup end-tag followed by optgroup start-tag", "input": [["EndTag", "optgroup"], ["StartTag", "optgroup", {}]], "expected": [""] }, {"description": "optgroup end-tag followed by end-tag", "input": [["EndTag", "optgroup"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "optgroup end-tag at EOF", "input": [["EndTag", "optgroup"]], "expected": [""] }, {"description": "option end-tag followed by comment", "input": [["EndTag", "option"], ["Comment", "foo"]], "expected": [""] }, {"description": "option end-tag followed by space character", "input": [["EndTag", "option"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "option end-tag followed by text", "input": [["EndTag", "option"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "option end-tag followed by start-tag", "input": [["EndTag", "option"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "option end-tag followed by option start-tag", "input": [["EndTag", "option"], ["StartTag", "option", {}]], "expected": [""] }, {"description": "option end-tag at EOF", "input": [["EndTag", "option"]], "expected": [""] }, {"description": "colgroup start-tag followed by comment", "input": [["StartTag", "colgroup", {}], ["Comment", "foo"]], "expected": ["
      "] }, {"description": "colgroup start-tag followed by space character", "input": [["StartTag", "colgroup", {}], ["Characters", " foo"]], "expected": ["foo"] }, {"description": "colgroup start-tag followed by text", "input": [["StartTag", "colgroup", {}], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "colgroup start-tag followed by start-tag", "input": [["StartTag", "colgroup", {}], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "first colgroup in a table with a col child", "input": [["StartTag", "table", {}], ["StartTag", "colgroup", {}], ["StartTag", "col", {}]], "expected": ["
      "] }, {"description": "colgroup with a col child, following another colgroup", "input": [["EndTag", "colgroup", {}], ["StartTag", "colgroup", {}], ["StartTag", "col", {}]], "expected": ["", ""] }, {"description": "colgroup start-tag followed by end-tag", "input": [["StartTag", "colgroup", {}], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "colgroup start-tag at EOF", "input": [["StartTag", "colgroup", {}]], "expected": [""] }, {"description": "colgroup end-tag followed by comment", "input": [["EndTag", "colgroup"], ["Comment", "foo"]], "expected": [""] }, {"description": "colgroup end-tag followed by space character", "input": [["EndTag", "colgroup"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "colgroup end-tag followed by text", "input": [["EndTag", "colgroup"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "colgroup end-tag followed by start-tag", "input": [["EndTag", "colgroup"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "colgroup end-tag followed by end-tag", "input": [["EndTag", "colgroup"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "colgroup end-tag at EOF", "input": [["EndTag", "colgroup"]], "expected": [""] }, {"description": "thead end-tag followed by comment", "input": [["EndTag", "thead"], ["Comment", "foo"]], "expected": [""] }, {"description": "thead end-tag followed by space character", "input": [["EndTag", "thead"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "thead end-tag followed by text", "input": [["EndTag", "thead"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "thead end-tag followed by start-tag", "input": [["EndTag", "thead"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "thead end-tag followed by tbody start-tag", "input": [["EndTag", "thead"], ["StartTag", "tbody", {}]], "expected": [""] }, {"description": "thead end-tag followed by tfoot start-tag", "input": [["EndTag", "thead"], ["StartTag", "tfoot", {}]], "expected": [""] }, {"description": "thead end-tag followed by end-tag", "input": [["EndTag", "thead"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "thead end-tag at EOF", "input": [["EndTag", "thead"]], "expected": [""] }, {"description": "tbody start-tag followed by comment", "input": [["StartTag", "tbody", {}], ["Comment", "foo"]], "expected": [""] }, {"description": "tbody start-tag followed by space character", "input": [["StartTag", "tbody", {}], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "tbody start-tag followed by text", "input": [["StartTag", "tbody", {}], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "tbody start-tag followed by start-tag", "input": [["StartTag", "tbody", {}], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "first tbody in a table with a tr child", "input": [["StartTag", "table", {}], ["StartTag", "tbody", {}], ["StartTag", "tr", {}]], "expected": ["
      "] }, {"description": "tbody with a tr child, following another tbody", "input": [["EndTag", "tbody", {}], ["StartTag", "tbody", {}], ["StartTag", "tr", {}]], "expected": ["", ""] }, {"description": "tbody with a tr child, following a thead", "input": [["EndTag", "thead", {}], ["StartTag", "tbody", {}], ["StartTag", "tr", {}]], "expected": ["", ""] }, {"description": "tbody with a tr child, following a tfoot", "input": [["EndTag", "tfoot", {}], ["StartTag", "tbody", {}], ["StartTag", "tr", {}]], "expected": ["", ""] }, {"description": "tbody start-tag followed by end-tag", "input": [["StartTag", "tbody", {}], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "tbody start-tag at EOF", "input": [["StartTag", "tbody", {}]], "expected": [""] }, {"description": "tbody end-tag followed by comment", "input": [["EndTag", "tbody"], ["Comment", "foo"]], "expected": [""] }, {"description": "tbody end-tag followed by space character", "input": [["EndTag", "tbody"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "tbody end-tag followed by text", "input": [["EndTag", "tbody"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "tbody end-tag followed by start-tag", "input": [["EndTag", "tbody"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "tbody end-tag followed by tbody start-tag", "input": [["EndTag", "tbody"], ["StartTag", "tbody", {}]], "expected": ["", ""] }, {"description": "tbody end-tag followed by tfoot start-tag", "input": [["EndTag", "tbody"], ["StartTag", "tfoot", {}]], "expected": [""] }, {"description": "tbody end-tag followed by end-tag", "input": [["EndTag", "tbody"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "tbody end-tag at EOF", "input": [["EndTag", "tbody"]], "expected": [""] }, {"description": "tfoot end-tag followed by comment", "input": [["EndTag", "tfoot"], ["Comment", "foo"]], "expected": [""] }, {"description": "tfoot end-tag followed by space character", "input": [["EndTag", "tfoot"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "tfoot end-tag followed by text", "input": [["EndTag", "tfoot"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "tfoot end-tag followed by start-tag", "input": [["EndTag", "tfoot"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "tfoot end-tag followed by tbody start-tag", "input": [["EndTag", "tfoot"], ["StartTag", "tbody", {}]], "expected": ["", ""] }, {"description": "tfoot end-tag followed by end-tag", "input": [["EndTag", "tfoot"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "tfoot end-tag at EOF", "input": [["EndTag", "tfoot"]], "expected": [""] }, {"description": "tr end-tag followed by comment", "input": [["EndTag", "tr"], ["Comment", "foo"]], "expected": [""] }, {"description": "tr end-tag followed by space character", "input": [["EndTag", "tr"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "tr end-tag followed by text", "input": [["EndTag", "tr"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "tr end-tag followed by start-tag", "input": [["EndTag", "tr"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "tr end-tag followed by tr start-tag", "input": [["EndTag", "tr"], ["StartTag", "tr", {}]], "expected": ["", ""] }, {"description": "tr end-tag followed by end-tag", "input": [["EndTag", "tr"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "tr end-tag at EOF", "input": [["EndTag", "tr"]], "expected": [""] }, {"description": "td end-tag followed by comment", "input": [["EndTag", "td"], ["Comment", "foo"]], "expected": [""] }, {"description": "td end-tag followed by space character", "input": [["EndTag", "td"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "td end-tag followed by text", "input": [["EndTag", "td"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "td end-tag followed by start-tag", "input": [["EndTag", "td"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "td end-tag followed by td start-tag", "input": [["EndTag", "td"], ["StartTag", "td", {}]], "expected": [""] }, {"description": "td end-tag followed by th start-tag", "input": [["EndTag", "td"], ["StartTag", "th", {}]], "expected": [""] }, {"description": "th end-tag followed by space character", "input": [["EndTag", "th"], ["Characters", " foo"]], "expected": [" foo"] }, {"description": "th end-tag followed by text", "input": [["EndTag", "th"], ["Characters", "foo"]], "expected": ["foo"] }, {"description": "th end-tag followed by start-tag", "input": [["EndTag", "th"], ["StartTag", "foo", {}]], "expected": [""] }, {"description": "th end-tag followed by th start-tag", "input": [["EndTag", "th"], ["StartTag", "th", {}]], "expected": [""] }, {"description": "th end-tag followed by td start-tag", "input": [["EndTag", "th"], ["StartTag", "td", {}]], "expected": ["
      ", "", ""] }, {"description": "td end-tag followed by end-tag", "input": [["EndTag", "td"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "td end-tag at EOF", "input": [["EndTag", "td"]], "expected": [""] }, {"description": "th end-tag followed by comment", "input": [["EndTag", "th"], ["Comment", "foo"]], "expected": ["", "", ""] }, {"description": "th end-tag followed by end-tag", "input": [["EndTag", "th"], ["EndTag", "foo", {}]], "expected": [""] }, {"description": "th end-tag at EOF", "input": [["EndTag", "th"]], "expected": [""] } ]}