From 0bc074bd5f825a287e00a54ac242ae2949d7f708 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Wed, 23 Dec 2015 15:48:22 -0500 Subject: [PATCH] add scripting flag to tests, fixes --- parse-html.coffee | 8 +++++--- test.coffee | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/parse-html.coffee b/parse-html.coffee index 8b2712d..d452803 100644 --- a/parse-html.coffee +++ b/parse-html.coffee @@ -1440,7 +1440,7 @@ parse_html = (args) -> if t.type is TYPE_START_TAG and t.name is 'title' parse_generic_rcdata_text t return - if t.type is TYPE_START_TAG and ((t.name is 'noscript' and flag_scripting) or (t.name is 'noframes' or t.name is 'style')) + if t.type is TYPE_START_TAG and ((t.name is 'noscript' and flag_scripting) or t.name is 'noframes' or t.name is 'style') parse_generic_raw_text t return if t.type is TYPE_START_TAG and t.name is 'noscript' and flag_scripting is false @@ -1502,14 +1502,14 @@ parse_html = (args) -> if t.type is TYPE_DOCTYPE parse_error() return - if t.type is TYPE_START_TAG + if t.type is TYPE_START_TAG and t.name is 'html' ins_mode_in_body t return if t.type is TYPE_END_TAG and t.name is 'noscript' open_els.shift() ins_mode = ins_mode_in_head return - if (t.type is TYPE_TEXT and (t.text is "\t" or t.text is "\u000a" or t.text is "\u000c" or t.text is "\u000d" or t.text is ' ')) or t.type is TYPE_COMMENT or (t.type is TYPE_START_TAG and (t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'style')) + if is_space_tok(t) or t.type is TYPE_COMMENT or (t.type is TYPE_START_TAG and (t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'style')) ins_mode_in_head t return if t.type is TYPE_END_TAG and t.name is 'br' @@ -3746,6 +3746,7 @@ parse_html = (args) -> tok_state = tok_state_comment_start_dash when "\u0000" parse_error() + tok_state = tok_state_comment return new_character_token "\ufffd" when '>' parse_error() @@ -3758,6 +3759,7 @@ parse_html = (args) -> return tok_cur_tag else tok_cur_tag.text += c + tok_state = tok_state_comment return null # 8.2.4.47 http://www.w3.org/TR/html5/syntax.html#comment-start-dash-state diff --git a/test.coffee b/test.coffee index 58b1ed8..289f46d 100644 --- a/test.coffee +++ b/test.coffee @@ -3474,27 +3474,33 @@ tests = [ }, { name: "tests16.dat #84" html: "" + scripting: true errors: 1 expected: "| \n| \n| \n|