JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix <html> at start
authorJason Woofenden <jason@jasonwoof.com>
Tue, 22 Dec 2015 17:18:51 +0000 (12:18 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Tue, 22 Dec 2015 17:18:51 +0000 (12:18 -0500)
parse-html.coffee

index 85a91af..e193118 100644 (file)
@@ -1157,7 +1157,7 @@ parse_html = (txt, parse_error_cb = null) ->
                if is_space_tok t
                        return
                if t.type is TYPE_COMMENT
-                       # fixfull this is supposed to be "the last child of the document object"
+                       # ?fixfull
                        doc.children.push t
                        return
                if t.type is TYPE_DOCTYPE
@@ -1184,6 +1184,7 @@ parse_html = (txt, parse_error_cb = null) ->
                        return
                if t.type is TYPE_START_TAG and t.name is 'html'
                        el = token_to_element t, NS_HTML, doc
+                       doc.children.push el
                        open_els.unshift(el)
                        # fixfull (big paragraph in spec about manifest, fragment, urls, etc)
                        insertion_mode = ins_mode_before_head
@@ -3364,7 +3365,7 @@ parse_html = (txt, parse_error_cb = null) ->
        # tree constructor initialization
        # see comments on TYPE_TAG/etc for the structure of this data
        doc = new Node TYPE_TAG, name: 'html', namespace: NS_HTML
-       open_els = [doc]
+       open_els = []
        afe = [] # active formatting elements
        template_insertion_modes = []
        insertion_mode = ins_mode_initial