diff --git a/lib/parse.js b/lib/parse.js index bf2ba6f001..aea8fae4a5 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -21,9 +21,9 @@ exports = module.exports = function(content, options, isDocument) { return root; }; -function parseWithParse5 (content, isDocument) { +function parseWithParse5 (content, options, isDocument) { var parse = isDocument ? parse5.parse : parse5.parseFragment, - root = parse(content, { treeAdapter: parse5.treeAdapters.htmlparser2 }); + root = parse(content, { treeAdapter: parse5.treeAdapters.htmlparser2, locationInfo: options.locationInfo }); return root.children; } @@ -39,7 +39,7 @@ exports.evaluate = function(content, options, isDocument) { if (typeof content === 'string') { var useHtmlParser2 = options.xmlMode || options._useHtmlParser2; - dom = useHtmlParser2 ? htmlparser.parseDOM(content, options) : parseWithParse5(content, isDocument); + dom = useHtmlParser2 ? htmlparser.parseDOM(content, options) : parseWithParse5(content, options, isDocument); } else { dom = content; }