Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug of the function val,html and text to parse content of html tag #36

Closed
zhaotianxiang opened this issue Mar 7, 2019 · 0 comments
Closed

Comments

@zhaotianxiang
Copy link

zhaotianxiang commented Mar 7, 2019

Test case as fllow:

const cheerio = require('cheerio');
const fs = require('fs');
const Entities = require('html-entities').XmlEntities;
const entities = new Entities();
let $ = cheerio.load(fs.readFileSync('./test.html').toString());
/**
----file: test.html ----

<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <textarea style="display:none">{"bug":"景点<1km"}</textarea>
</body>
</html>

**/
let html = $('body > textarea').html();
let text = $('body > textarea').text();
let val = $('body > textarea').val();
// I want test {"bug":"景点<1km"}, but it return: {"bug":"
console.log(html);
console.log(text);
console.log(val);
console.log(entities.decode(html));

I can't get what i want :

 {"bug":"景点<1km"}

I think the char "<" should not be processed in a string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant