Skip to content

New CSS selector ":contains(text)" #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ee1578e
Added new pseudo-clas type 'contains'; Added placeholder function for…
f34nk Feb 27, 2018
97fc234
Marked function as TODO and added default return
f34nk Feb 27, 2018
d6e9727
Added _contains declaration
f34nk Feb 27, 2018
f2bd21d
Incremented xy_LAST_ENTRY
f34nk Feb 27, 2018
bfdc22b
Added missing functions
f34nk Mar 3, 2018
f5e7360
In Progress...
f34nk Mar 8, 2018
b97bce9
Removed binaries
f34nk Mar 10, 2018
6322e2c
Added more debugging prints
f34nk Mar 21, 2018
6b7c2c4
Generated new 'mycss_selectors_function_begin_map_index' with 'perl u…
f34nk Mar 21, 2018
3ef1c28
Removed some debug printing
f34nk Mar 21, 2018
bfc5256
In progress
f34nk Mar 21, 2018
aed3e3d
Prepared for serialization...
f34nk Mar 24, 2018
5883615
modest_finder_selector_sub_type_pseudo_class_function_contains in pro…
f34nk Mar 24, 2018
bec0bc8
Implemented modest_finder_selector_sub_type_pseudo_class_function_con…
f34nk Mar 24, 2018
b4e4e45
Some cleanup...
f34nk Mar 24, 2018
a3040f2
Removed all dev printing
f34nk Mar 24, 2018
11bddf6
Minor change
f34nk Mar 24, 2018
5feb533
Merge branch 'master' into support-for-pseudo-class-contains
f34nk Mar 25, 2018
8b947b6
Cleanup
f34nk Mar 25, 2018
8dc0c4c
Cleanup
f34nk Mar 26, 2018
bee75d5
Added parser for 'contains'
f34nk Mar 26, 2018
2f65f50
Removed concat function; Refactored 'modest_finder_selector_sub_type_…
f34nk Mar 26, 2018
f8076d9
Added comma separated arguments test
f34nk Mar 26, 2018
76b1839
Added failed allocation check
f34nk Mar 26, 2018
d650d01
Removed memory leak in case mycore_realloc failes
f34nk Mar 26, 2018
412ba67
Cleaned formatting
f34nk Mar 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/modest/finder/pseudo_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_child(modest
bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_column(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);
bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);
bool modest_finder_selector_sub_type_pseudo_class_function_nth_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);
bool modest_finder_selector_sub_type_pseudo_class_function_contains(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);

/* classes */
bool modest_finder_selector_sub_type_pseudo_class_undef(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);
Expand Down
2 changes: 1 addition & 1 deletion include/modest/finder/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static const modest_finder_selector_type_f modest_finder_static_selector_sub_typ
{
modest_finder_selector_sub_type_pseudo_class_function_undef, /* UNDEF */
modest_finder_selector_sub_type_pseudo_class_function_undef, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_UNKNOWN */
modest_finder_selector_sub_type_pseudo_class_function_contains, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CONTAINS */
modest_finder_selector_sub_type_pseudo_class_function_current, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CURRENT */
modest_finder_selector_sub_type_pseudo_class_function_dir, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DIR */
modest_finder_selector_sub_type_pseudo_class_function_drop, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DROP */
Expand All @@ -54,7 +55,6 @@ static const modest_finder_selector_type_f modest_finder_static_selector_sub_typ
modest_finder_selector_sub_type_pseudo_class_function_nth_last_column, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_COLUMN */
modest_finder_selector_sub_type_pseudo_class_function_nth_last_of_type, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_OF_TYPE */
modest_finder_selector_sub_type_pseudo_class_function_nth_of_type /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_OF_TYPE */

};

/* see enum mycss_selectors_sub_type (mycss_selectors_sub_type_t) on mycss/selectors/myosi.h */
Expand Down
1 change: 1 addition & 0 deletions include/mycss/selectors/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void mycss_selectors_function_begin_nth_last_child(mycss_entry_t* entry, mycss_s
void mycss_selectors_function_begin_nth_last_of_type(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
void mycss_selectors_function_begin_has(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
void mycss_selectors_function_begin_nth_column(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
void mycss_selectors_function_begin_contains(mycss_entry_t* entry, mycss_selectors_entry_t* selector);

void mycss_selectors_begin_unknown(mycss_entry_t* entry, mycss_selectors_entry_t* selector);

Expand Down
2 changes: 2 additions & 0 deletions include/mycss/selectors/function_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ bool mycss_selectors_unknown_parser(mycss_entry_t* entry, mycss_token_t* token,
bool mycss_selectors_function_parser_not_or_matches_or_current_parser(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_selectors_function_parser_has(mycss_entry_t* entry, mycss_token_t* token, bool last_response);

bool mycss_selectors_function_parser_contains(mycss_entry_t* entry, mycss_token_t* token, bool last_response);

bool mycss_selectors_function_parser_nth_with_selectors(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_selectors_function_parser_nth_with_selectors_need_of(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_selectors_function_parser_nth_with_selectors_need_of_after(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
Expand Down
4 changes: 2 additions & 2 deletions include/mycss/selectors/function_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#define MyCSS_SELECTORS_FUNCTION_NAME_STATIC_SIZE 57

static const mycss_selectots_function_begin_entry_t mycss_selectors_function_begin_map_index[] =
static const mycss_selectots_function_begin_entry_t mycss_selectors_function_begin_map_index[] =
{
{NULL, 0, NULL, 0, 0},
{"dir", 3, mycss_selectors_function_begin_dir, 0, 1},
Expand Down Expand Up @@ -78,7 +78,7 @@ static const mycss_selectots_function_begin_entry_t mycss_selectors_function_beg
{"nth-child", 9, mycss_selectors_function_begin_nth_child, 0, 49},
{NULL, 0, NULL, 0, 0},
{NULL, 0, NULL, 0, 0},
{NULL, 0, NULL, 0, 0},
{"contains", 8, mycss_selectors_function_begin_contains, 0, 52},
{NULL, 0, NULL, 0, 0},
{NULL, 0, NULL, 0, 0},
{NULL, 0, NULL, 0, 0},
Expand Down
29 changes: 15 additions & 14 deletions include/mycss/selectors/myosi.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,21 @@ typedef mycss_selectors_sub_type_t;
enum mycss_selectors_sub_type_pseudo_class_function {
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_UNDEF = 0x00,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_UNKNOWN = 0x01,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CURRENT = 0x02,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DIR = 0x03,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DROP = 0x04,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_HAS = 0x05,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LANG = 0x06,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_MATCHES = 0x07,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NOT = 0x08,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_CHILD = 0x09,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_COLUMN = 0x0a,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_CHILD = 0x0b,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_COLUMN = 0x0c,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_OF_TYPE = 0x0d,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_OF_TYPE = 0x0e,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LAST_ENTRY = 0x0f
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CONTAINS = 0x02,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CURRENT = 0x03,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DIR = 0x04,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DROP = 0x05,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_HAS = 0x06,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LANG = 0x07,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_MATCHES = 0x08,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NOT = 0x09,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_CHILD = 0x0a,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_COLUMN = 0x0b,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_CHILD = 0x0c,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_COLUMN = 0x0d,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_OF_TYPE = 0x0e,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_OF_TYPE = 0x0f,
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LAST_ENTRY = 0x10
}
typedef mycss_selectors_sub_type_pseudo_class_function_t;

Expand Down
2 changes: 2 additions & 0 deletions include/mycss/selectors/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ void * mycss_selectors_value_pseudo_class_function_nth_last_child_create(mycss_e
void * mycss_selectors_value_pseudo_class_function_nth_last_column_create(mycss_entry_t* entry, bool set_clean);
void * mycss_selectors_value_pseudo_class_function_nth_last_of_type_create(mycss_entry_t* entry, bool set_clean);
void * mycss_selectors_value_pseudo_class_function_nth_of_type_create(mycss_entry_t* entry, bool set_clean);
void * mycss_selectors_value_pseudo_class_function_contains_create(mycss_entry_t* entry, bool set_clean);

/* pseudo class function destroy */
void * mycss_selectors_value_pseudo_class_function_undef_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
Expand All @@ -99,6 +100,7 @@ void * mycss_selectors_value_pseudo_class_function_nth_last_child_destroy(mycss_
void * mycss_selectors_value_pseudo_class_function_nth_last_column_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
void * mycss_selectors_value_pseudo_class_function_nth_last_of_type_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
void * mycss_selectors_value_pseudo_class_function_nth_of_type_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
void * mycss_selectors_value_pseudo_class_function_contains_destroy(mycss_entry_t* entry, void* value, bool self_destroy);

#ifdef __cplusplus
} /* extern "C" */
Expand Down
1 change: 1 addition & 0 deletions include/mycss/selectors/value_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static const mycss_selectors_value_destroy_f mycss_selectors_value_destroy_map[M
static const mycss_selectors_value_function_destroy_f mycss_selectors_value_function_destroy_map[MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LAST_ENTRY] = {
mycss_selectors_value_pseudo_class_function_undef_destroy,
mycss_selectors_value_pseudo_class_function_undef_destroy,
mycss_selectors_value_pseudo_class_function_contains_destroy,
mycss_selectors_value_pseudo_class_function_current_destroy,
mycss_selectors_value_pseudo_class_function_dir_destroy,
mycss_selectors_value_pseudo_class_function_drop_destroy,
Expand Down
7 changes: 4 additions & 3 deletions source/modest/finder/finder.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ mystatus_t modest_finder_by_selectors_list(modest_finder_t* finder, myhtml_tree_
if(status)
return MODEST_STATUS_ERROR_MEMORY_ALLOCATION;
}

for(size_t i = 0; i < selector_list->entries_list_length; i++) {
mycss_selectors_specificity_t spec = selector_list->entries_list[i].specificity;

Expand All @@ -179,6 +179,7 @@ myhtml_tree_node_t * modest_finder_node_combinator_begin(modest_finder_t* finder
if(selector == NULL)
return NULL;


myhtml_tree_node_t *node = base_node;

while(node) {
Expand All @@ -191,7 +192,7 @@ myhtml_tree_node_t * modest_finder_node_combinator_begin(modest_finder_t* finder
}
else {
myhtml_tree_node_t *find_node = modest_finder_static_selector_combinator_map[selector->next->combinator](finder, node, selector_list, selector->next, spec, callback_found, ctx);

if(find_node == NULL) {
while(node != base_node && node->next == NULL)
node = node->parent;
Expand All @@ -217,7 +218,7 @@ myhtml_tree_node_t * modest_finder_node_combinator_begin(modest_finder_t* finder
node = node->next;
}
}

return NULL;
}

Expand Down
66 changes: 66 additions & 0 deletions source/modest/finder/pseudo_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,72 @@ bool modest_finder_selector_sub_type_pseudo_class_function_has(modest_finder_t*
return false;
}

bool modest_finder_selector_sub_type_pseudo_class_function_contains(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
if(base_node == NULL)
return false;

myhtml_tree_node_t *text_node = myhtml_node_child(base_node);
if(text_node == NULL)
return false;

const char* text = myhtml_node_text(text_node, NULL);
if(text == NULL)
return false;

mycss_selectors_list_t *list = (mycss_selectors_list_t*)selector->value;
for(size_t i = 0; i < list->entries_list_length; i++) {
char *data = NULL;
data = mycore_malloc(0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(data == NULL) {
    return false;
}

if(data == NULL) {
return false;
}

mycss_selectors_entry_t *sel_entry = list->entries_list[i].entry;
if(sel_entry->key->data){
const char *str = sel_entry->key->data;
int length = strlen(str) + 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line after this


char *new_data = mycore_realloc(data, length);
if(new_data == NULL) {
mycore_free(data);
return false;
}

snprintf(new_data, length, "%s", str);
data = new_data;
}

mycss_selectors_entry_t *next = sel_entry->next;
while(next) {
if(next->key->data) {
int prev = strlen(data);
const char *whitespace = (prev > 0) ? " " : "";
const char *str = next->key->data;
int length = strlen(whitespace) + strlen(str) + 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line after


char *new_data = mycore_realloc(data, prev + length);
if(new_data == NULL) {
mycore_free(data);
return false;
}

snprintf(&new_data[prev], length, "%s%s", whitespace, str);
data = new_data;
}
next = next->next;
}

if(strstr(text, data) != NULL) {
mycore_free(data);
return true;
}
mycore_free(data);
}

return false;
}

bool modest_finder_selector_sub_type_pseudo_class_function_lang(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
return false;
Expand Down
1 change: 1 addition & 0 deletions source/modest/finder/pseudo_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_child(modest
bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_column(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);
bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);
bool modest_finder_selector_sub_type_pseudo_class_function_nth_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);
bool modest_finder_selector_sub_type_pseudo_class_function_contains(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);

/* classes */
bool modest_finder_selector_sub_type_pseudo_class_undef(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec);
Expand Down
3 changes: 2 additions & 1 deletion source/modest/finder/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static const modest_finder_selector_type_f modest_finder_static_selector_sub_typ
{
modest_finder_selector_sub_type_pseudo_class_function_undef, /* UNDEF */
modest_finder_selector_sub_type_pseudo_class_function_undef, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_UNKNOWN */
modest_finder_selector_sub_type_pseudo_class_function_contains, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CONTAINS */
modest_finder_selector_sub_type_pseudo_class_function_current, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CURRENT */
modest_finder_selector_sub_type_pseudo_class_function_dir, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DIR */
modest_finder_selector_sub_type_pseudo_class_function_drop, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DROP */
Expand All @@ -53,7 +54,7 @@ static const modest_finder_selector_type_f modest_finder_static_selector_sub_typ
modest_finder_selector_sub_type_pseudo_class_function_nth_last_child, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_CHILD */
modest_finder_selector_sub_type_pseudo_class_function_nth_last_column, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_COLUMN */
modest_finder_selector_sub_type_pseudo_class_function_nth_last_of_type, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_OF_TYPE */
modest_finder_selector_sub_type_pseudo_class_function_nth_of_type /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_OF_TYPE */
modest_finder_selector_sub_type_pseudo_class_function_nth_of_type /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_OF_TYPE */

};

Expand Down
19 changes: 19 additions & 0 deletions source/mycss/selectors/function.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,25 @@ void mycss_selectors_function_begin_has(mycss_entry_t* entry, mycss_selectors_en
mycss_entry_parser_list_push(entry, mycss_selectors_function_parser_has, entry->parser_switch, entry->parser_ending_token, false);
}

void mycss_selectors_function_begin_contains(mycss_entry_t* entry, mycss_selectors_entry_t* selector)
{
selector->sub_type = MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CONTAINS;

mycss_selectors_t *selectors = entry->selectors;
mycss_selectors_list_t **new_list = (mycss_selectors_list_t**)(&selectors->entry_last->value);
mycss_selectors_list_t *current_list = selectors->list_last;

selectors->list = new_list;
selectors->list_last = NULL;
selectors->ending_token = entry->parser_ending_token;

mycss_selectors_state_relative_selector_list(entry, NULL, true);

(*new_list)->parent = current_list;

mycss_entry_parser_list_push(entry, mycss_selectors_function_parser_contains, entry->parser_switch, entry->parser_ending_token, false);
}

void mycss_selectors_function_begin_nth_last_child(mycss_entry_t* entry, mycss_selectors_entry_t* selector)
{
selector->sub_type = MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_CHILD;
Expand Down
1 change: 1 addition & 0 deletions source/mycss/selectors/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void mycss_selectors_function_begin_nth_last_child(mycss_entry_t* entry, mycss_s
void mycss_selectors_function_begin_nth_last_of_type(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
void mycss_selectors_function_begin_has(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
void mycss_selectors_function_begin_nth_column(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
void mycss_selectors_function_begin_contains(mycss_entry_t* entry, mycss_selectors_entry_t* selector);

void mycss_selectors_begin_unknown(mycss_entry_t* entry, mycss_selectors_entry_t* selector);

Expand Down
Loading