# File lib/html5/html5parser/in_caption_phase.rb, line 32
    def endTagCaption(name)
      if ignoreEndTagCaption
        # inner_html case
        assert @parser.inner_html
        parse_error "unexpected-end-tag", {"name" => name}
      else
        # AT this code is quite similar to endTagTable in "InTable"
        @tree.generateImpliedEndTags

        unless @tree.open_elements[-1].name == 'caption'
          parse_error("expected-one-end-tag-but-got-another",
                    {"gotName" => "caption",
                     "expectedName" => @tree.open_elements.last.name})
        end

        remove_open_elements_until('caption')

        @tree.clearActiveFormattingElements
        @parser.phase = @parser.phases[:inTable]
      end
    end