Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
peach-html5-editor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9d56a83
)
fix noah's ark and empty cdata
author
Jason Woofenden
<jason@jasonwoof.com>
Thu, 24 Dec 2015 16:26:44 +0000
(11:26 -0500)
committer
Jason Woofenden
<jason@jasonwoof.com>
Thu, 24 Dec 2015 16:26:44 +0000
(11:26 -0500)
parse-html.coffee
patch
|
blob
|
history
diff --git
a/parse-html.coffee
b/parse-html.coffee
index
3d4db84
..
b3b3f7f
100644
(file)
--- a/
parse-html.coffee
+++ b/
parse-html.coffee
@@
-668,18
+668,29
@@
parse_html = (args) ->
else
console.log "Parse error at character #{cur} of #{txt.length}"
else
console.log "Parse error at character #{cur} of #{txt.length}"
+ # http://www.w3.org/TR/html5/syntax.html#push-onto-the-list-of-active-formatting-elements
+ # "Noah's Ark clause" but with three
afe_push = (new_el) ->
matches = 0
for el, i in afe
afe_push = (new_el) ->
matches = 0
for el, i in afe
+ if el.type is TYPE_AFE_MARKER
+ break
if el.name is new_el.name and el.namespace is new_el.namespace
if el.name is new_el.name and el.namespace is new_el.namespace
+ attrs_match = true
for k, v of el.attrs
for k, v of el.attrs
- continue unless new_el.attrs[k] is v
- for k, v of new_el.attrs
- continue unless el.attrs[k] is v
- matches += 1
- if matches is 3
- afe.splice i, 1
- break
+ unless new_el.attrs[k] is v
+ attrs_match = false
+ break
+ if attrs_match
+ for k, v of new_el.attrs
+ unless el.attrs[k] is v
+ attrs_match = false
+ break
+ if attrs_match
+ matches += 1
+ if matches is 3
+ afe.splice i, 1
+ break
afe.unshift new_el
afe_push_marker = ->
afe.unshift new_afe_marker()
afe.unshift new_el
afe_push_marker = ->
afe.unshift new_afe_marker()
@@
-4525,7
+4536,9
@@
parse_html = (args) ->
else
val = txt.substr cur, (next_gt - cur)
cur = next_gt + 3
else
val = txt.substr cur, (next_gt - cur)
cur = next_gt + 3
- return new_character_token val # fixfull split
+ if val.length > 0
+ return new_character_token val # fixfull split
+ return null
# 8.2.4.69 http://www.w3.org/TR/html5/syntax.html#consume-a-character-reference
# Don't set this as a state, just call it
# 8.2.4.69 http://www.w3.org/TR/html5/syntax.html#consume-a-character-reference
# Don't set this as a state, just call it
@@
-4648,7
+4661,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
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 "tests20.dat #22"
+ if args.name is "tests23.dat #1"
console.log "hi"
# proccess input
# http://www.w3.org/TR/html5/syntax.html#tree-construction
console.log "hi"
# proccess input
# http://www.w3.org/TR/html5/syntax.html#tree-construction