mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-06 23:44:43 -04: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:
parent
fde874ad35
commit
9f3456c872
@ -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) {
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user