1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-19 00:05:36 +00:00

Add support for parsing space separated CSS class attribute values

Sequentially apply style for stuff like class="class1 class2".
This commit is contained in:
Jonas Fonseca 2006-06-06 15:21:00 +02:00 committed by Jonas Fonseca
parent fde874ad35
commit 9f3456c872
2 changed files with 15 additions and 3 deletions

View File

@ -189,10 +189,20 @@ examine_element(struct html_context *html_context, struct css_selector *base,
code = get_attr_val(element->options, "class", html_context->options);
if (code && seltype <= CST_CLASS) {
selector = find_css_selector(selectors, CST_CLASS, rel, code, -1);
process_found_selector(selector, CST_CLASS, base);
unsigned char *class = code;
while (class) {
unsigned char *end = strchr(class, ' ');
if (end)
*end++ = 0;
selector = find_css_selector(selectors, CST_CLASS, rel, class, -1);
process_found_selector(selector, CST_CLASS, base);
class = end;
}
}
if (code) mem_free(code);
mem_free_if(code);
code = get_attr_val(element->options, "id", html_context->options);
if (code && seltype <= CST_ID) {

View File

@ -2,6 +2,7 @@
div { color: yellow }
div#foo { background: red }
div.foo { background: blue }
div.bar { color: red }
div .foo{ background: purple }
p,span { color: aqua; }
div, { background: green; }
@ -14,5 +15,6 @@
<div>div <span>span</span> div <span class="foo">spanclass</span> div</div>
<div id="foo">id</div>
<div class="foo">class <i>i</i></div>
<div class="foo bar">red on blue</div>
<p>p <span>i</span> <b>bold <span>i</span></b></p>
<p><b>jedi<i> mind </i>tricks</b></p>