1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#ifndef WEB_DOM_H
#define WEB_DOM_H
#include <stdbool.h>
struct elem {
char *ns, *name, *content;
int n_attrs, size_attrs;
char **attr_names, **attr_vals;
};
struct elem *elem_init(char *ns, char *name, int size_attrs);
void elem_free(struct elem *e);
void elem_add_attr(struct elem *e, char *name, char *val);
void elem_add_attr_double(struct elem *e, char *name, double val);
void append_elemv(char *sel, int elemc, struct elem **elemv);
char *dom_elem_get_content(char *sel);
void dom_elem_set_content(char *sel, char *str);
void dom_elem_set_value(char *sel, char *str);
bool dom_elem_has_class(char *sel, char *class);
void dom_elem_add_class(char *sel, char *class);
void dom_elem_remove_class(char *sel, char *class);
void dom_elem_toggle_class(char *sel, char *class);
void dom_elem_set_uniq_class(char *sel, char *class, char *sel_set);
void dom_elem_scroll_to_bottom(char *sel);
#endif
|