JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix in_table_text
authorJason Woofenden <jason@jasonwoof.com>
Thu, 24 Dec 2015 01:23:13 +0000 (20:23 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Thu, 24 Dec 2015 01:23:13 +0000 (20:23 -0500)
parse-html.coffee

index 73eda84..9911bc0 100644 (file)
@@ -2202,7 +2202,8 @@ parse_html = (args) ->
        ins_mode_in_table = (t) ->
                switch t.type
                        when TYPE_TEXT
-                               if t.name is 'table' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead' or t.name is 'tr'
+                               if (open_els[0].name is 'table' or open_els[0].name is 'tbody' or open_els[0].name is 'tfoot' or open_els[0].name is 'thead' or open_els[0].name is 'tr') and open_els[0].namespace is NS_HTML
+                                       pending_table_character_tokens = []
                                        original_ins_mode = ins_mode
                                        ins_mode = ins_mode_in_table_text
                                        process_token t
@@ -2292,7 +2293,7 @@ parse_html = (args) ->
        # 8.2.5.4.10 http://www.w3.org/TR/html5/syntax.html#parsing-main-intabletext
        ins_mode_in_table_text = (t) ->
                if t.type is TYPE_TEXT and t.text is "\u0000"
-                       # huh? I thought the tokenizer didn't emit these
+                       # from javascript?
                        parse_error()
                        return
                if t.type is TYPE_TEXT
@@ -2309,8 +2310,8 @@ parse_html = (args) ->
                                insert_character old
                else
                        for old in pending_table_character_tokens
-                               ins_mode_table_else old
-               pending_table_character_tokens = [] # FIXME test (spec doesn't say this)
+                               ins_mode_in_table_else old
+               pending_table_character_tokens = []
                ins_mode = original_ins_mode
                process_token t