1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Make non-terminated comments and cdata sections have 'the rest' as content

This commit is contained in:
Jonas Fonseca 2005-12-31 01:47:57 +01:00 committed by Jonas Fonseca
parent 8f7f6abc16
commit 7489c134f7
2 changed files with 25 additions and 6 deletions

View File

@ -205,7 +205,10 @@ skip_comment(struct dom_scanner *scanner, unsigned char **string)
} }
} }
if (!pos) pos = scanner->end; if (!pos) {
pos = scanner->end;
length = pos - *string;
}
*string = pos; *string = pos;
return length; return length;
@ -227,7 +230,10 @@ skip_cdata_section(struct dom_scanner *scanner, unsigned char **string)
} }
} }
if (!pos) pos = scanner->end; if (!pos) {
pos = scanner->end;
length = pos - *string;
}
*string = pos; *string = pos;
return length; return length;

View File

@ -64,17 +64,18 @@ element: root
test_output_equals \ test_output_equals \
'Parse comment combinations.' \ 'Parse comment combinations.' \
'<root><!-- <!-- -- > --><!----></root>' \ '<root><!-- <!-- -- > --><!--foo--><!----></root>' \
' '
element: root element: root
#comment: <!-- -- > #comment: <!-- -- >
#comment: foo
#comment: ' #comment: '
test_output_equals \ test_output_equals \
'Parse comment combinations.' \ 'Parse bad comment.' \
'<!--foo-->' \ '<!--->s' \
' '
#comment: foo' #comment: ->s'
test_output_equals \ test_output_equals \
'Parse an enclosed CDATA section.' \ 'Parse an enclosed CDATA section.' \
@ -83,6 +84,18 @@ test_output_equals \
element: root element: root
#cdata-section: ...] ]>...' #cdata-section: ...] ]>...'
test_output_equals \
'Parse non-enclosed CDATA section.' \
'<![CDATA[...]]>' \
'
#cdata-section: ...'
test_output_equals \
'Parse a bad CDATA section.' \
'<![CDATA[...' \
'
#cdata-section: ...'
test_output_equals \ test_output_equals \
'Parse attributes.' \ 'Parse attributes.' \
'<root lang="fr" attr name="value with &foo; <stuff"></root>' \ '<root lang="fr" attr name="value with &foo; <stuff"></root>' \