cheeriojs/cheerio

Some attributes values get ="" appended to values

MonkeyNinja opened this issue · 0 comments

For some reason the attribute gets parsed and return with a space after the opening quote in the json field, and ="" appended after the value.

const cheerio = require('cheerio');
const html_input = '<span data-cpp-props="{ \\\"prop_a\\\"\:0}" >html</span>';

console.log("intput");
console.log( html_input );

// i've tried a couple of options to fix, no joy...
const doc = cheerio.load(html_input , { xmlMode: false , decodeEntities:false} , false );
const content = doc.html(); 

console.log("output");
console.log( content );
PS C:\Users\MonkeyNinja\Documents\Projects\cheerio-testing> node .\main.js
intput
<span data-cpp-props="{ \"prop_a\":0}" >html</span>
output
<span data-cpp-props="{ \" prop_a\":0}"="">html</span>
// another test, this flips the quotes and adds html encoding to the json
const html_input_ = "<span data-cpp-props='{ \"prop_a\":2}' >html</span>";
// ie
// <span data-cpp-props="{ &quot;prop_a&quot;:2}">html</span>