kuchiki-rs / kuchiki

(朽木) HTML/XML tree manipulation library for Rust
MIT License
470 stars 54 forks source link

Question: Equivalent of innerHTML method #80

Closed hipstermojo closed 4 years ago

hipstermojo commented 4 years ago

The innerHTML method in the DOM API returns a string of the HTML structure of an element node. Is there an efficient way to make such a function call in Kuchiki? The thing that comes closest for me, is:

node_ref.serialize()

which can then be converted to a String but this looks very inefficient if it is repeatedly called.

SimonSapin commented 4 years ago

.innerHTML in the DOM likely has similar (in)efficiency as .serialize() in Kuchiki. Unless some browsers silently cache it, but I don’t know if accessing it repeatedly without changing that subtree is common enough that such a cache would be worth the memory usage.

hipstermojo commented 4 years ago

Alright. Thanks for the response.