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) {
if(!element.getAttribute(‘loading’)){
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 => {
event.respondWith(handleRequest(event.request))
})

HTML still seems to work for me

https://cloudflareworkers.com/#0d90ff419f80ecfc9c55e3b292efa2c1:https://tutorial.cloudflareworkers.com

It doesn’t if you do something like this though - it wraps the h1’s in quotes:
https://cloudflareworkers.com/#159d7a32432b48979f40ed71eb1bae1f:https://tutorial.cloudflareworkers.com

It appears it actually does work

image

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