1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-15 14:54:40 -04:00

Fix bug #741: "html comments shouldn't be evaluted inside STYLE elements"

This commit is contained in:
Timo Lindfors 2006-02-22 19:45:14 -05:00 committed by Jonas Fonseca
parent 78bcc240db
commit 00ed4bf3ef
3 changed files with 6 additions and 3 deletions

View File

@ -67,6 +67,7 @@ struct html_context {
unsigned int was_br:1;
unsigned int was_xmp:1;
unsigned int was_style:1;
unsigned int has_link_lines:1;
unsigned int was_body:1; /* For META refresh inside <body>. */
unsigned int was_body_background:1; /* For <HTML> with style. */

View File

@ -353,6 +353,7 @@ void
html_style(struct html_context *html_context, unsigned char *a,
unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)
{
html_context->was_style = 1;
html_skip(html_context, a);
}

View File

@ -700,7 +700,7 @@ next_break:
}
if (html + 2 <= eof && html[0] == '<' && (html[1] == '!' || html[1] == '?')
&& !html_context->was_xmp) {
&& !(html_context->was_xmp || html_context->was_style)) {
put_chrs(html_context, base_pos, html - base_pos);
html = skip_comment(html, eof);
continue;
@ -901,6 +901,7 @@ end_element(struct element_info *ei,
int kill = 0;
if (ei->func == html_xmp) html_context->was_xmp = 0;
if (ei->func == html_style) html_context->was_style = 0;
html_context->was_br = 0;
if (ei->type == ELEMENT_TYPE_NON_PAIRABLE
@ -974,8 +975,8 @@ process_element(unsigned char *name, int namelen, int endingtag,
#else
ei = (struct element_info *) fastfind_search(&ff_tags_index, name, namelen);
#endif
if (html_context->was_xmp) {
if (!ei || ei->func != html_xmp || !endingtag) {
if (html_context->was_xmp || html_context->was_style) {
if (!ei || (ei->func != html_xmp && ei->func != html_style) || !endingtag) {
put_chrs(html_context, "<", 1);
return prev_html + 1;
}