How to tell cheerio NOT to change the attributes to lowercase?
Currently, cheerio turns fooBar into foobar. how to NOT do it?
const cheerio = require("cheerio");
const html = `
<div>
<h4></h4>
<img src="">
<input>
<p fooBar></p>
</div>
`;
const $ = cheerio.load(html);
const output = $.html();
console.log({ output });
I try to add lowerCaseAttributeNames according to answer in github but this not help:
const $ = cheerio.load(html, { lowerCaseAttributeNames: false });
The results:
<html><head></head><body><div>
<h4></h4>
<img src>
<input>
<p foobar></p> <------------------foobar. expected: fooBar
</div>
</body></html>
I try with xmlMode, but it creates closing problem:
<div>
<h4/>
<img src="">
<input>
<p fooBar=""/>
</input></img></div>
UPADTE
I searched the lowerCaseAttributeNames in Github, but it only exist in the types, not sure it have impact on the code :(