- # TODO
- when 'address', 'article', 'aside', 'blockquote', 'center', 'details', 'dialog', 'dir', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'header', 'hgroup', 'main', 'nav', 'ol', 'p', 'section', 'summary', 'ul'
- close_p_if_in_button_scope()
- insert_html_element t
- when 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
- close_p_if_in_button_scope()
- if open_els[0].name in ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
- parse_error()
- open_els.shift()
- insert_html_element t
- # TODO lots more to implement here
- when 'a'
- # If the list of active formatting elements
- # contains an a element between the end of the list and
- # the last marker on the list (or the start of the list
- # if there is no marker on the list), then this is a
- # parse error; run the adoption agency algorithm for
- # the tag name "a", then remove that element from the
- # list of active formatting elements and the stack of
- # open elements if the adoption agency algorithm didn't
- # already remove it (it might not have if the element
- # is not in table scope).
- found = false
- for el in afe
- if el.type is TYPE_AFE_MARKER
- break
- if el.name is 'a'
- found = el
- if found?
- parse_error()
- adoption_agency 'a'
- for el, i in afe
- if el is found
- afe.splice i, 1
- for el, i in open_els
- if el is found
- open_els.splice i, 1
- reconstruct_active_formatting_elements()
- el = insert_html_element t
- afe_push el
- when 'b', 'big', 'code', 'em', 'font', 'i', 's', 'small', 'strike', 'strong', 'tt', 'u'
- reconstruct_active_formatting_elements()
- el = insert_html_element t
- afe_push el
- when 'table'
- # fixfull quirksmode thing
- close_p_if_in_button_scope()
- insert_html_element t
- insertion_mode = ins_mode_in_table
- # TODO lots more to implement here
- else # any other start tag
- reconstruct_active_formatting_elements()
- insert_html_element t
- when TYPE_EOF
- ok_tags = {
- dd: true, dt: true, li: true, p: true, tbody: true, td: true,
- tfoot: true, th: true, thead: true, tr: true, body: true, html: true,
- }
- for t in open_els
- unless ok_tags[t.name]?