mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Fix bug #741: "html comments shouldn't be evaluted inside STYLE elements"
This commit is contained in:
parent
dbc46f73f7
commit
212b4a2893
@ -67,6 +67,7 @@ struct html_context {
|
|||||||
|
|
||||||
unsigned int was_br:1;
|
unsigned int was_br:1;
|
||||||
unsigned int was_xmp:1;
|
unsigned int was_xmp:1;
|
||||||
|
unsigned int was_style:1;
|
||||||
unsigned int has_link_lines:1;
|
unsigned int has_link_lines:1;
|
||||||
unsigned int was_body:1; /* For META refresh inside <body>. */
|
unsigned int was_body:1; /* For META refresh inside <body>. */
|
||||||
unsigned int was_body_background:1; /* For <HTML> with style. */
|
unsigned int was_body_background:1; /* For <HTML> with style. */
|
||||||
|
@ -353,6 +353,7 @@ void
|
|||||||
html_style(struct html_context *html_context, unsigned char *a,
|
html_style(struct html_context *html_context, unsigned char *a,
|
||||||
unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)
|
unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)
|
||||||
{
|
{
|
||||||
|
html_context->was_style = 1;
|
||||||
html_skip(html_context, a);
|
html_skip(html_context, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,7 +700,7 @@ next_break:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (html + 2 <= eof && html[0] == '<' && (html[1] == '!' || html[1] == '?')
|
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);
|
put_chrs(html_context, base_pos, html - base_pos);
|
||||||
html = skip_comment(html, eof);
|
html = skip_comment(html, eof);
|
||||||
continue;
|
continue;
|
||||||
@ -904,6 +904,7 @@ end_element(struct element_info *ei,
|
|||||||
int kill = 0;
|
int kill = 0;
|
||||||
|
|
||||||
if (ei->func == html_xmp) html_context->was_xmp = 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;
|
html_context->was_br = 0;
|
||||||
if (ei->type == ELEMENT_TYPE_NON_PAIRABLE
|
if (ei->type == ELEMENT_TYPE_NON_PAIRABLE
|
||||||
@ -977,8 +978,8 @@ process_element(unsigned char *name, int namelen, int endingtag,
|
|||||||
#else
|
#else
|
||||||
ei = (struct element_info *) fastfind_search(&ff_tags_index, name, namelen);
|
ei = (struct element_info *) fastfind_search(&ff_tags_index, name, namelen);
|
||||||
#endif
|
#endif
|
||||||
if (html_context->was_xmp) {
|
if (html_context->was_xmp || html_context->was_style) {
|
||||||
if (!ei || ei->func != html_xmp || !endingtag) {
|
if (!ei || (ei->func != html_xmp && ei->func != html_style) || !endingtag) {
|
||||||
put_chrs(html_context, "<", 1);
|
put_chrs(html_context, "<", 1);
|
||||||
return prev_html + 1;
|
return prev_html + 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user