1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix HTML parsing when body is included in the select tag

Fixes #3079
This commit is contained in:
Nick O'Leary 2021-07-23 10:09:00 +01:00
parent 6e69cfbca4
commit c5892fc17e
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 4 additions and 2 deletions

View File

@ -32,7 +32,7 @@ module.exports = function(RED) {
var tag = node.tag;
if (msg.hasOwnProperty("select")) { tag = node.tag || msg.select; }
try {
var $ = cheerio.load(value,null,false);
var $ = cheerio.load(value);
var pay = [];
var count = 0;
$(tag).each(function() {

View File

@ -68,7 +68,9 @@ describe('HTML node', function() {
done(err)
}
});
n1.receive({payload:data,topic:"bar",select:"h1"});
// include 'body' in the select to verify we're in document mode
// for the parser. See https://github.com/node-red/node-red/issues/3079
n1.receive({payload:data,topic:"bar",select:"body h1"});
});
});
});