Compare commits

...

3 Commits

Author SHA1 Message Date
trans_soup 58f2997449 Merge branch 'dev' 2023-07-16 15:16:13 +02:00
trans_soup 0ca932c700 clean up dev branch to make merging easier. 2023-07-16 15:15:17 +02:00
trans_soup 9f5473cea8 fix bug with attribute setting.
(with a hack solution made without understanding how setting different
kinds of element attributes work.)
2023-07-16 15:09:10 +02:00
1 changed files with 4 additions and 0 deletions

View File

@ -20,7 +20,11 @@ export function json_as_html (json, state = new Map()) {
const elem = document.createElement(type);
attributes.forEach(([key, value]) => {
// from testing: class only works with the former, onclick only work with the latter. so both are used here :)
// also from testing: this only works in this specific order.
// TODO: learn how element attribute setting works and create something more reliable.
elem.setAttribute(key, value);
elem[key] = value;
});
const child_nodes = use_as_array(children).map(child => json_as_html(child, state))