Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access Html from HtmlTreeSink without finishing #225

Closed
max-heller opened this issue Jan 1, 2025 · 1 comment · Fixed by #226
Closed

Access Html from HtmlTreeSink without finishing #225

max-heller opened this issue Jan 1, 2025 · 1 comment · Fixed by #226

Comments

@max-heller
Copy link
Contributor

I have a use-case where I want to be able to query the tree while parsing is still ongoing (i.e., the tree (Html) is in a HtmlTreeSink). Would it be possible to add a method to borrow the Html from a HtmlTreeSink to avoid having to destroy and recreate the HtmlTreeSink?

@adamreichold
Copy link
Member

IIRC, HtmlTreeSink is just a wrapper that became necessary as html5ever stopped implementing interior mutability itself and so we had to add a RefCell layer. But I don't think anything bad would happen if we make that RefCell<Html> public so it can be accessed as e.g. sink.0.borrow().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants