Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 702d3c9

Browse files
author
Edward Z. Yang ext:(%22)
committed
Fix Ruby implementation for changed test-case (see last commit)
1 parent b41d91c commit 702d3c9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/html5/html5parser/after_head_phase.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module HTML5
44
class AfterHeadPhase < Phase
55

66
handle_start 'html', 'body', 'frameset', %w( base link meta script style title ) => 'FromHead'
7+
handle_end %w( body html br ) => 'BodyHtmlBr'
78

89
def process_eof
910
anything_else
@@ -36,15 +37,19 @@ def startTagOther(name, attributes)
3637
@parser.phase.processStartTag(name, attributes)
3738
end
3839

39-
def processEndTag(name)
40+
def endTagBodyHtmlBr(name)
4041
anything_else
4142
@parser.phase.processEndTag(name)
4243
end
4344

45+
def endTagOther(name)
46+
parse_error("unexpected-end-tag")
47+
end
48+
4449
def anything_else
4550
@tree.insert_element('body', {})
4651
@parser.phase = @parser.phases[:inBody]
4752
end
4853

4954
end
50-
end
55+
end

lib/html5/html5parser/in_head_phase.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class InHeadPhase < Phase
77
handle_start %w( base link meta)
88

99
handle_end 'head'
10-
handle_end %w( body br ) => 'ImplyAfterHead'
10+
handle_end %w( html body br ) => 'ImplyAfterHead'
1111
handle_end %w( title style script noscript )
1212

1313
def process_eof

0 commit comments

Comments
 (0)