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?
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