HTMLRewriter not detecting content of `<noscript>`

Hey folks, hope y’all doing great!

I noticed that HTMLRewriter api does detect elements inside <noscript></noscript> tags. Note that following code does not delete the div inside noscript tag.

Just wondering whether this is a bug. If not, what would be the best approach to removing content of noscript tag without loading the body into worker memory.

Thank you,
Lavneet

2 Likes

I can confirm the same.

The following does not apply the HTMLFragmentIdElementHandler() on <noscript> nor any of it’s children.

    const handler = new HTMLFragmentIdElementHandler();
    return new HTMLRewriter().on('*', handler).transform(response);

@lavneetpuri did you find a fix / workaround for this?