is_mathml_text_integration_point = (el) ->
return mathml_text_integration[el.name] is el.namespace
is_html_integration = (el) -> # DON'T PASS A TOKEN
is_mathml_text_integration_point = (el) ->
return mathml_text_integration[el.name] is el.namespace
is_html_integration = (el) -> # DON'T PASS A TOKEN
- if el.namespace is NS_MATHML and el.name is 'annotation-xml'
- if el.attrs.encoding?
- if el.attrs.encoding.toLowerCase() is 'text/html'
- return true
- if el.attrs.encoding.toLowerCase() is 'application/xhtml+xml'
- return true
+ if el.namespace is NS_MATHML
+ if el.name is 'annotation-xml'
+ if el.attrs.encoding?
+ if el.attrs.encoding.toLowerCase() is 'text/html'
+ return true
+ if el.attrs.encoding.toLowerCase() is 'application/xhtml+xml'
+ return true
h1:NS_HTML, h2:NS_HTML, h3:NS_HTML, h4:NS_HTML, h5:NS_HTML, h6:NS_HTML
}
h1:NS_HTML, h2:NS_HTML, h3:NS_HTML, h4:NS_HTML, h5:NS_HTML, h6:NS_HTML
}
debug_log "tree: #{serialize_els doc.children, false, true}"
debug_log "open_els: #{serialize_els open_els, true, true}"
debug_log "afe: #{serialize_els afe, true, true}"
debug_log "tree: #{serialize_els doc.children, false, true}"
debug_log "open_els: #{serialize_els open_els, true, true}"
debug_log "afe: #{serialize_els afe, true, true}"
# http://www.w3.org/TR/html5/syntax.html#close-a-p-element
close_p_element = ->
generate_implied_end_tags 'p' # arg is exception
# http://www.w3.org/TR/html5/syntax.html#close-a-p-element
close_p_element = ->
generate_implied_end_tags 'p' # arg is exception
# If foster parenting is enabled and target is a table, tbody, tfoot,
# thead, or tr element Foster parenting happens when content is
# misnested in tables.
# If foster parenting is enabled and target is a table, tbody, tfoot,
# thead, or tr element Foster parenting happens when content is
# misnested in tables.
loop # once. this is here so we can ``break`` to "abort these substeps"
# 1. Let last template be the last template element in the
# stack of open elements, if any.
loop # once. this is here so we can ``break`` to "abort these substeps"
# 1. Let last template be the last template element in the
# stack of open elements, if any.
# 8.2.5.3 http://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags
# http://www.w3.org/TR/html5/syntax.html#generate-implied-end-tags
generate_implied_end_tags = (except = null) ->
# 8.2.5.3 http://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags
# http://www.w3.org/TR/html5/syntax.html#generate-implied-end-tags
generate_implied_end_tags = (except = null) ->
# 8.2.5.4.7 http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody
in_body_any_other_end_tag = (name) -> # factored out because adoption agency calls it
for el, i in open_els
# 8.2.5.4.7 http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody
in_body_any_other_end_tag = (name) -> # factored out because adoption agency calls it
for el, i in open_els
open_els[0].flag 'already started', true
open_els.shift()
ins_mode = original_ins_mode
open_els[0].flag 'already started', true
open_els.shift()
ins_mode = original_ins_mode
when 'body', 'caption', 'col', 'colgroup', 'html', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr'
parse_error()
when 'template'
when 'body', 'caption', 'col', 'colgroup', 'html', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr'
parse_error()
when 'template'
# 8.2.5.4.11 http://www.w3.org/TR/html5/syntax.html#parsing-main-incaption
ins_mode_in_caption = (t) ->
if t.type is TYPE_END_TAG and t.name is 'caption'
# 8.2.5.4.11 http://www.w3.org/TR/html5/syntax.html#parsing-main-incaption
ins_mode_in_caption = (t) ->
if t.type is TYPE_END_TAG and t.name is 'caption'
- if is_in_table_scope t.name # fixfull namespace
- if is_in_table_scope 'tr'
+ if is_in_table_scope t.name, NS_HTML
+ if is_in_table_scope 'tr', NS_HTML
# 8.2.5.4.15 http://www.w3.org/TR/html5/syntax.html#parsing-main-intd
ins_mode_in_cell = (t) ->
if t.type is TYPE_END_TAG and (t.name is 'td' or t.name is 'th')
# 8.2.5.4.15 http://www.w3.org/TR/html5/syntax.html#parsing-main-intd
ins_mode_in_cell = (t) ->
if t.type is TYPE_END_TAG and (t.name is 'td' or t.name is 'th')
- if open_els[0].name is 'option' and open_els[1].name is 'optgroup'
- open_els.shift()
- if open_els[0].name is 'optgroup'
+ if open_els[0].name is 'option' and open_els[0].namespace in NS_HTML
+ if open_els[1].name is 'optgroup' and open_els[0].namespace is NS_HTML
+ open_els.shift()
+ if open_els[0].name is 'optgroup' and open_els[0].namespace is NS_HTML
module.exports.parse_html = parse_html
module.exports.debug_log_reset = debug_log_reset
module.exports.debug_log_each = debug_log_each
module.exports.parse_html = parse_html
module.exports.debug_log_reset = debug_log_reset
module.exports.debug_log_each = debug_log_each