diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-09 18:02:30 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-09 18:09:24 -0700 |
commit | c227fb7cc9e30d6a4330cdad34b0b2a53b014d93 (patch) | |
tree | 4d5f6f4bfcb15e67de4bb588334f3b7facf86aa4 /web/web_prompt.c | |
parent | 9ba644fd849ef7664be009e00206bf5eb1b85762 (diff) | |
download | dartboat-c227fb7cc9e30d6a4330cdad34b0b2a53b014d93.tar.gz dartboat-c227fb7cc9e30d6a4330cdad34b0b2a53b014d93.tar.xz |
web: add support for child DOM elements and text nodes
Diffstat (limited to 'web/web_prompt.c')
-rw-r--r-- | web/web_prompt.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/web/web_prompt.c b/web/web_prompt.c index 3b5bc68..3f5521a 100644 --- a/web/web_prompt.c +++ b/web/web_prompt.c @@ -89,13 +89,22 @@ static void flush_list_opts() for (int i = 0; i < list_optc; ++i) { struct dom_elem *e = dom_elem_init(NULL, "div", 2); - asprintf(&e->content, "[%d] %s", i + 1, list_optv[i]); dom_elem_add_attr(e, "class", "key"); char buf[64]; sprintf(buf, "append:%d;submit", i + 1); dom_elem_add_attr(e, "data-command", buf); + struct dom_elem *child; + child = dom_elem_init(NULL, "span", 1); + asprintf(&child->content, "[%d]", i + 1); + dom_elem_add_attr(child, "class", "keyboard-val"); + dom_elem_add_child(e, child); + + sprintf(buf, "\u2002%s", list_optv[i]); + child = dom_text_init(buf); + dom_elem_add_child(e, child); + elemv[i] = e; } |