html5ever icon indicating copy to clipboard operation
html5ever copied to clipboard

When are TreeSink's methods called

Open Zizico2 opened this issue 2 years ago • 3 comments

This is the second issue I open asking for support about html5ever (the other one was in kuchiki) (is there a better place to get support?). When are methods like remove_from_parent and reparent_children called outside of a browser environment? If I parse an html file will those ever get called or are they supposed to be called by JavaScript? Could it be documented when/why methods are called and in which use cases do they decisively need to be implemented (or if I can, for example, improve the performance of other methods to the detriment of methods that won't be called or will barely be called in my use case).

Zizico2 avatar Oct 19 '21 18:10 Zizico2

They can be invoked by the html5 parsing rules. For example, there are various callers for both methods in code under html5ever/src/tree_builder/.

jdm avatar Oct 19 '21 23:10 jdm

okok thanks. while we're on the topic... Will every created element be used? Or can a created element be left dangling, not appended to the tree. Will they all be popped, so I can implement pop and listen to that?

Zizico2 avatar Oct 22 '21 02:10 Zizico2

I can't imagine a situation where an element would be created but not appended to the tree.

jdm avatar Oct 22 '21 12:10 jdm