Added more HTML closing rules for colgroup/caption
This commit is contained in:
parent
7d9604fd93
commit
1c095ddaff
|
@ -66,8 +66,8 @@ module Oga
|
||||||
'rp' => NodeNameSet.new(%w{rb rt rtc rp}),
|
'rp' => NodeNameSet.new(%w{rb rt rtc rp}),
|
||||||
'optgroup' => NodeNameSet.new(%w{optgroup}),
|
'optgroup' => NodeNameSet.new(%w{optgroup}),
|
||||||
'option' => NodeNameSet.new(%w{option optgroup}),
|
'option' => NodeNameSet.new(%w{option optgroup}),
|
||||||
'colgroup' => NodeNameSet.new(%w{thead tbody tfoot}),
|
'colgroup' => NodeNameSet.new(%w{thead tbody tfoot colgroup tr}),
|
||||||
'caption' => NodeNameSet.new(%w{thead tbody tfoot}),
|
'caption' => NodeNameSet.new(%w{thead tbody tfoot colgroup tr caption}),
|
||||||
'thead' => NodeNameSet.new(%w{thead tbody tfoot}),
|
'thead' => NodeNameSet.new(%w{thead tbody tfoot}),
|
||||||
'tbody' => NodeNameSet.new(%w{thead tbody tfoot}),
|
'tbody' => NodeNameSet.new(%w{thead tbody tfoot}),
|
||||||
'tfoot' => NodeNameSet.new(%w{thead tbody tfoot}),
|
'tfoot' => NodeNameSet.new(%w{thead tbody tfoot}),
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Oga::XML::Lexer do
|
||||||
|
describe 'HTML caption elements' do
|
||||||
|
it 'lexes an unclosed <caption> followed by another <caption>' do
|
||||||
|
lex_html('<caption>foo<caption>bar').should == [
|
||||||
|
[:T_ELEM_NAME, 'caption', 1],
|
||||||
|
[:T_TEXT, 'foo', 1],
|
||||||
|
[:T_ELEM_END, nil, 1],
|
||||||
|
[:T_ELEM_NAME, 'caption', 1],
|
||||||
|
[:T_TEXT, 'bar', 1],
|
||||||
|
[:T_ELEM_END, nil, 1]
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'lexes an unclosed <caption> followed by a <colgroup>' do
|
||||||
|
lex_html('<caption>foo<colgroup>bar').should == [
|
||||||
|
[:T_ELEM_NAME, 'caption', 1],
|
||||||
|
[:T_TEXT, 'foo', 1],
|
||||||
|
[:T_ELEM_END, nil, 1],
|
||||||
|
[:T_ELEM_NAME, 'colgroup', 1],
|
||||||
|
[:T_TEXT, 'bar', 1],
|
||||||
|
[:T_ELEM_END, nil, 1]
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Oga::XML::Lexer do
|
||||||
|
describe 'HTML colgroup elements' do
|
||||||
|
it 'lexes an unclosed <colgroup> followed by another <colgroup>' do
|
||||||
|
lex_html('<colgroup>foo<colgroup>bar').should == [
|
||||||
|
[:T_ELEM_NAME, 'colgroup', 1],
|
||||||
|
[:T_TEXT, 'foo', 1],
|
||||||
|
[:T_ELEM_END, nil, 1],
|
||||||
|
[:T_ELEM_NAME, 'colgroup', 1],
|
||||||
|
[:T_TEXT, 'bar', 1],
|
||||||
|
[:T_ELEM_END, nil, 1]
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue