lol-html icon indicating copy to clipboard operation
lol-html copied to clipboard

HTMLRewriter’s element.setAttribute() method alters the surrounding single quote character

Open Febtw opened this issue 1 year ago • 0 comments

I’m using the element.setAttribute() method within Cloudflare Workers’ HTMLRewriter. When attempting to set attributes for HTML elements using this method, if the attribute value is enclosed in single quotes ('), HTMLRewriter converts it to double quotes ("). This results in attribute values being enclosed in double quotes. Is there any way to keep the original surrounding quotes, after element.setAttribute() sets the attribute?

This issue resembles a similar issue found in cheerio Maintain tag attribute quote characters · Issue #720 · cheeriojs/cheerio · GitHub use single quotes for values that contain double quotes

Febtw avatar Apr 11 '24 09:04 Febtw