From 38367e9bad7bcad9f30c2c86d15feba64c71e1ad Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Wed, 23 Dec 2015 14:18:51 -0500 Subject: [PATCH] namespace tweaks, fix --- parse-html.coffee | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/parse-html.coffee b/parse-html.coffee index 31a46f4..55d73a3 100644 --- a/parse-html.coffee +++ b/parse-html.coffee @@ -1191,7 +1191,7 @@ parse_html = (txt, parse_error_cb = null) -> last_template = null last_template_i = null for el, i in open_els - if el.name is 'template' + if el.name is 'template' and el.namespace is NS_HTML last_template = el last_template_i = i break @@ -1200,7 +1200,7 @@ parse_html = (txt, parse_error_cb = null) -> last_table = null last_table_i for el, i in open_els - if el.name is 'table' + if el.name is 'table' and el.namespace is NS_HTML last_table = el last_table_i = i break @@ -1222,6 +1222,7 @@ parse_html = (txt, parse_error_cb = null) -> # this is odd target = open_els[open_els.length - 1] target_i = target.children.length + break # 5. If last table has a parent element, then let adjusted # insertion location be inside last table's parent element, # immediately before last table, and abort these substeps. @@ -2100,19 +2101,6 @@ parse_html = (txt, parse_error_cb = null) -> return return - ins_mode_in_table_else = (t) -> - parse_error() - flag_foster_parenting = true # FIXME - ins_mode_in_body t - flag_foster_parenting = false - can_in_table = { # FIXME do this inline like everywhere else - 'table': true - 'tbody': true - 'tfoot': true - 'thead': true - 'tr': true - } - # 8.2.5.4.8 http://www.w3.org/TR/html5/syntax.html#parsing-main-incdata ins_mode_text = (t) -> if t.type is TYPE_TEXT @@ -2142,6 +2130,19 @@ parse_html = (txt, parse_error_cb = null) -> # http://www.w3.org/TR/html5/syntax.html#tokenization # 8.2.5.4.9 http://www.w3.org/TR/html5/syntax.html#parsing-main-intable + ins_mode_in_table_else = (t) -> + parse_error() + flag_foster_parenting = true + ins_mode_in_body t + flag_foster_parenting = false + return + can_in_table = { # FIXME do this inline like everywhere else + 'table': true + 'tbody': true + 'tfoot': true + 'thead': true + 'tr': true + } ins_mode_in_table = (t) -> switch t.type when TYPE_TEXT @@ -2192,7 +2193,7 @@ parse_html = (txt, parse_error_cb = null) -> when 'style', 'script', 'template' ins_mode_in_head t when 'input' - if is_input_hidden_tok t + unless is_input_hidden_tok t ins_mode_in_table_else t else parse_error() -- 1.7.10.4