1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Let CSS selectors select non-pairable elements

This necessitates that non-pairable elements be briefly pushed on the stack, so that get_css_selector_for_element sees them, and then popped.

It would be possible to push them only when CONFIG_CSS is defined, as they are otherwise not needed (as evidenced by the fact that we've gone so long without bothering to push them).  However, the performance hit should be small, the necessary #ifdef/#endif wrappers would be pretty ugly, and ideally, the CSS code will someday be in such a state that it can be considered an integral feature.
This commit is contained in:
Miciah Dashiel Butler Masters 2007-10-09 14:14:45 +00:00
parent 13523248ed
commit f2f478eb2f

View File

@ -876,27 +876,25 @@ start_element(struct element_info *ei,
}
}
if (ei->type != ET_NON_PAIRABLE) {
html_stack_dup(html_context, ELEMENT_KILLABLE);
html_top->name = name;
html_top->namelen = namelen;
html_top->options = attr;
html_top->linebreak = ei->linebreak;
html_stack_dup(html_context, ELEMENT_KILLABLE);
html_top->name = name;
html_top->namelen = namelen;
html_top->options = attr;
html_top->linebreak = ei->linebreak;
#ifdef CONFIG_ECMASCRIPT
if (has_attr(attr, "onClick", html_context->doc_cp)) {
/* XXX: Put something better to format.link. --pasky */
mem_free_set(&format.link, stracpy("javascript:void(0);"));
mem_free_set(&format.target, stracpy(html_context->base_target));
format.style.fg = format.clink;
html_top->pseudo_class = ELEMENT_LINK;
mem_free_set(&format.title, stracpy("onClick placeholder"));
/* Er. I know. Well, double html_focusable()s shouldn't
* really hurt. */
html_focusable(html_context, attr);
}
#endif
if (has_attr(attr, "onClick", html_context->doc_cp)) {
/* XXX: Put something better to format.link. --pasky */
mem_free_set(&format.link, stracpy("javascript:void(0);"));
mem_free_set(&format.target, stracpy(html_context->base_target));
format.style.fg = format.clink;
html_top->pseudo_class = ELEMENT_LINK;
mem_free_set(&format.title, stracpy("onClick placeholder"));
/* Er. I know. Well, double html_focusable()s shouldn't
* really hurt. */
html_focusable(html_context, attr);
}
#endif
#ifdef CONFIG_CSS
if (html_top->options && html_context->options->css_enable) {
@ -946,6 +944,9 @@ start_element(struct element_info *ei,
if (ei->open != html_br) html_context->was_br = 0;
if (ei->type == ET_NON_PAIRABLE)
kill_html_stack_item(html_context, html_top);
if (restore_format) par_format = old_format;
return html;