Add or remove elements #259
-
Hey there! I wanted to dynamicly create or remove elements from the document to not modify strings and parse the whole document again. auto new_el = mydocument->create_element("div", {{"class", "clazz"}});
...
mydocument->root()->get_child(kBodyIndex)->appendChild(new_el);
...
doc->render(width, litehtml::render_all);
litehtml::position clip(0, 0, width, height);
doc->draw(0, 0, 0, &clip); But unfortunatly there isn't much happening. Should this work? Do I miss something? Expection: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ah... |
Beta Was this translation helpful? Give feedback.
Ah...
So I've now moved https://github.com/litehtml/litehtml/blob/master/src/document.cpp#L80-L132 into its own function and now calling it after the dom updates. That works at least for me very seamlessly.