X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=parse-html.coffee;h=20bc99c39de4543dc344ad4f79e8ff9e39f2ac85;hb=55d1353f6b2bf2f9b056c1083125369dfcdf3102;hp=487fe9941a7eb2c69c1e42ec66929ec88d71102f;hpb=e0b4df676109a785258fa3bf09e38fc6ea3f4440;p=peach-html5-editor.git diff --git a/parse-html.coffee b/parse-html.coffee index 487fe99..20bc99c 100644 --- a/parse-html.coffee +++ b/parse-html.coffee @@ -2157,7 +2157,8 @@ parse_html = (args) -> return if t.type is TYPE_END_TAG and t.name is 'br' parse_error() - t.type = TYPE_START_TAG + # W3C: t.type = TYPE_START_TAG + t = new_open_tag 'br' # WHATWG # fall through if t.type is TYPE_START_TAG and (t.name is 'area' or t.name is 'br' or t.name is 'embed' or t.name is 'img' or t.name is 'keygen' or t.name is 'wbr') reconstruct_afe() @@ -3092,7 +3093,7 @@ parse_html = (args) -> tok_state = tok_state_tag_open when "\u0000" parse_error() - return new_text_node "\ufffd" + return new_text_node c when '' # EOF return new_eof_token() else @@ -3789,7 +3790,7 @@ parse_html = (args) -> return if c is '>' tok_state = tok_state_data - return + return tok_cur_tag if is_uc_alpha(c) tok_cur_tag.attrs_a.unshift [c.toLowerCase(), ''] tok_state = tok_state_attribute_name @@ -4542,6 +4543,7 @@ parse_html = (args) -> else val = txt.substr cur, (next_gt - cur) cur = next_gt + 3 + val = val.replace(new RegExp("\u0000", 'g'), "\ufffd") if val.length > 0 return new_character_token val # fixfull split return null @@ -4681,11 +4683,10 @@ parse_html = (args) -> # text pre-processing # FIXME http://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream - txt = txt.replace(new RegExp("\u0000", 'g'), "\ufffd") # fixfull spec doesn't say this 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 "tests23.dat #1" + if args.name is "webkit01.dat #12" console.log "hi" # proccess input # http://www.w3.org/TR/html5/syntax.html#tree-construction