JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix minor parsing bugs
authorJason Woofenden <jason@jasonwoof.com>
Thu, 24 Dec 2015 04:44:27 +0000 (23:44 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Thu, 24 Dec 2015 04:44:27 +0000 (23:44 -0500)
parse-html.coffee

index 0fb97b9..b25359d 100644 (file)
@@ -2726,7 +2726,8 @@ parse_html = (args) ->
                        ins_mode_in_body t
                        return
                if t.type is TYPE_COMMENT
-                       insert_comment t, [open_els[0], open_els[0].children.length]
+                       first = open_els[open_els.length - 1]
+                       insert_comment t, [first, first.children.length]
                        return
                if t.type is TYPE_DOCTYPE
                        parse_error()
@@ -2805,7 +2806,7 @@ parse_html = (args) ->
                        ins_mode_in_body t
                        return
                if t.type is TYPE_END_TAG and t.name is 'html'
-                       insert_mode = ins_mode_after_after_frameset
+                       ins_mode = ins_mode_after_after_frameset
                        return
                if t.type is TYPE_START_TAG and t.name is 'noframes'
                        ins_mode_in_head t
@@ -4514,7 +4515,7 @@ parse_html = (args) ->
        txt = txt.replace(new RegExp("\r\n", 'g'), "\n") # fixfull spec doesn't say this
        txt = txt.replace(new RegExp("\r", 'g'), "\n") # fixfull spec doesn't say this
 
-       if args.name is "tests16.dat #25"
+       if args.name is "tests18.dat #17"
                console.log "hi"
        # proccess input
        # http://www.w3.org/TR/html5/syntax.html#tree-construction