Html rewriter - html true not working any longer?

Hi, the script below was working fine previously, but recently something seems to have changed and it’s now wrapping the img element in quotes, rather than leaving it as raw html. Has there been a change in the way the html:true option works?

const elbefore = “”
const elafter = “”

class ElementHandler {
element(element) {
element.setAttribute(‘loading’, ‘lazy’);
element.before(elbefore,{ html: true });
element.after(elafter,{ html: true });

async function handleRequest(req) {
const res = await fetch(req);

return new HTMLRewriter().on(‘img’, new ElementHandler()).transform(res)

addEventListener(‘fetch’, event => {

HTML still seems to work for me

It doesn’t if you do something like this though - it wraps the h1’s in quotes:

It appears it actually does work


Also, your HTML is technically not correct (you should use double, not single quotes) but that is not necessarily the issue here.