From 170634bfa1e3eb0862c0b383493b0364bc95a2b7 Mon Sep 17 00:00:00 2001 From: 5saviahv <5saviahv@users.noreply.github.com> Date: Mon, 1 Feb 2021 04:27:38 +0200 Subject: [PATCH 1/4] expose parse5 option scriptingEnabled --- lib/parsers/parse5.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/parsers/parse5.js b/lib/parsers/parse5.js index 870103c3f5..e20bc84419 100644 --- a/lib/parsers/parse5.js +++ b/lib/parsers/parse5.js @@ -4,6 +4,10 @@ var htmlparser2Adapter = require('parse5-htmlparser2-tree-adapter'); exports.parse = function (content, options, isDocument) { var opts = { + scriptingEnabled: + typeof options.scriptingEnabled === 'boolean' + ? options.scriptingEnabled + : true, treeAdapter: htmlparser2Adapter, sourceCodeLocationInfo: options.sourceCodeLocationInfo, }; From 324ab2e671d4fbfe0ef0cd55a128573b043d05fc Mon Sep 17 00:00:00 2001 From: 5saviahv <5saviahv@users.noreply.github.com> Date: Sat, 6 Feb 2021 22:45:46 +0200 Subject: [PATCH 2/4] parse5 options test --- test/__fixtures__/fixtures.js | 10 ++++++ test/cheerio.js | 64 +++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/test/__fixtures__/fixtures.js b/test/__fixtures__/fixtures.js index 79f85ca3f0..e232515c1c 100644 --- a/test/__fixtures__/fixtures.js +++ b/test/__fixtures__/fixtures.js @@ -84,3 +84,13 @@ exports.forms = [ '
', '', ].join(''); + +exports.noscript = [ + '