mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Update to latest cheerio module
This commit is contained in:
@@ -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);
|
||||
var $ = cheerio.load(value,null,false);
|
||||
var pay = [];
|
||||
var count = 0;
|
||||
$(tag).each(function() {
|
||||
@@ -42,9 +42,11 @@ module.exports = function(RED) {
|
||||
$(tag).each(function() {
|
||||
if (node.as === "multi") {
|
||||
var pay2 = null;
|
||||
if (node.ret === "html") { pay2 = cheerio.load($(this).html().trim()).xml(); }
|
||||
if (node.ret === "html") { pay2 = cheerio.load($(this).html().trim(),null,false).xml(); }
|
||||
if (node.ret === "text") { pay2 = $(this).text(); }
|
||||
if (node.ret === "attr") { pay2 = this.attribs; }
|
||||
if (node.ret === "attr") {
|
||||
pay2 = Object.assign({},this.attribs);
|
||||
}
|
||||
//if (node.ret === "val") { pay2 = $(this).val(); }
|
||||
/* istanbul ignore else */
|
||||
if (pay2) {
|
||||
@@ -61,9 +63,12 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
if (node.as === "single") {
|
||||
if (node.ret === "html") { pay.push( cheerio.load($(this).html().trim()).xml() ); }
|
||||
if (node.ret === "html") { pay.push( cheerio.load($(this).html().trim(),null,false).xml() ); }
|
||||
if (node.ret === "text") { pay.push( $(this).text() ); }
|
||||
if (node.ret === "attr") { pay.push( this.attribs ); }
|
||||
if (node.ret === "attr") {
|
||||
var attribs = Object.assign({},this.attribs);
|
||||
pay.push( attribs );
|
||||
}
|
||||
//if (node.ret === "val") { pay.push( $(this).val() ); }
|
||||
}
|
||||
index++;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
"acorn-walk": "8.1.0",
|
||||
"ajv": "8.5.0",
|
||||
"body-parser": "1.19.0",
|
||||
"cheerio": "0.22.0",
|
||||
"cheerio": "^1.0.0-rc.9",
|
||||
"content-type": "1.0.4",
|
||||
"cookie-parser": "1.4.5",
|
||||
"cookie": "0.4.1",
|
||||
|
Reference in New Issue
Block a user