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

Introduce innerHTML handlers #78

Open
nox opened this issue Feb 2, 2021 · 7 comments
Open

Introduce innerHTML handlers #78

nox opened this issue Feb 2, 2021 · 7 comments

Comments

@nox
Copy link

nox commented Feb 2, 2021

Request extracted from #40. We want innerHTML handlers that allow users to modify the raw HTML of an element, similar to how they are already able to modify the element's text contents with text handlers. See this comment.

@cdloh
Copy link

cdloh commented Nov 17, 2021

@nox @xtuc @inikulin would there be a way for me to ask this work looked at?

It'd be really handy to have this in the htmlrewriter within workers. I'm currently looking at potentially replacing some rather unwieldy WASM code with htmlrewriter but being able to access the raw HTML within an element is a key part of it.

Should I speak with our AM?

@alexnj
Copy link

alexnj commented Nov 9, 2022

Bumping this (old) issue — is there a supported/recommended way to extract HTML of a node (.innerHTML and .outerHTML) with HTMLRewriter/lol-html? Or would it be advisable to switch to full DOM parsing?

@CodeFromAnywhere
Copy link

bump

@madhadron
Copy link

Until we have an innerHTML method, is there a workaround to get this from the element?

@PepijnSenders
Copy link

bump

@luwes
Copy link

luwes commented Dec 23, 2023

would love to know if this is possible as well.
it looks like it is with end_tag_handlers from this example if you build up the HTML manually
https://github.com/cloudflare/lol-html/blob/master/src/rewritable_units/element.rs#L496-L537

@bangank36
Copy link

Until we have an innerHTML method, is there a workaround to get this from the element?

I followed this practice and it is working well for my usecase https://workers.tools/guides/2022-02-19-how-to-use-htmlrewriter-for-web-scraping/#extracting-html-subtrees

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

No branches or pull requests

8 participants