From e4969585f79549750d3a943bec789866169ac2ff Mon Sep 17 00:00:00 2001 From: jywarren Date: Tue, 5 Mar 2019 12:50:25 -0500 Subject: [PATCH] insert original html next to raw in verbose mode --- lib/htmlparser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/htmlparser.js b/lib/htmlparser.js index 04668e0..b1cc0da 100644 --- a/lib/htmlparser.js +++ b/lib/htmlparser.js @@ -264,16 +264,17 @@ if (typeof(module) !== 'undefined' && typeof(module.exports) !== 'undefined') { state.needData = true; return; } - var raw; + var raw, original; if (match[4] === '>') { state.mode = Mode.Text; raw = match[0].substr(0, match[0].length - 1); + original = state.data; } else { state.mode = Mode.Attr; raw = match[0]; } state.pos += match[0].length; - var tag = { type: Mode.Tag, name: match[1] + match[2], raw: raw }; + var tag = { type: Mode.Tag, name: match[1] + match[2], raw: raw , original: original}; if (state.mode === Mode.Attr) { state.lastTag = tag; }