This commit is contained in:
taoqf 2020-04-09 10:41:42 +08:00
parent ee97545974
commit d266fb999a

View file

@ -623,6 +623,9 @@ export function parse(data: string, options = {} as Options) {
} }
} }
lastTextPos = kMarkupPattern.lastIndex; lastTextPos = kMarkupPattern.lastIndex;
if (match[2] === frameflag) {
continue;
}
if (match[0][1] === '!') { if (match[0][1] === '!') {
// this is a comment // this is a comment
if (options.comment) { if (options.comment) {
@ -649,12 +652,10 @@ export function parse(data: string, options = {} as Options) {
currentParent = arr_back(stack); currentParent = arr_back(stack);
} }
} }
if (match[2] !== frameflag) { // ignore container tag we add above
// ignore container tag we add above // https://github.com/taoqf/node-html-parser/issues/38
// https://github.com/taoqf/node-html-parser/issues/38 currentParent = currentParent.appendChild(new HTMLElement(match[2], attrs, match[3]));
currentParent = currentParent.appendChild(new HTMLElement(match[2], attrs, match[3])); stack.push(currentParent);
stack.push(currentParent);
}
if (kBlockTextElements[match[2]]) { if (kBlockTextElements[match[2]]) {
// a little test to find next </script> or </style> ... // a little test to find next </script> or </style> ...
const closeMarkup = '</' + match[2] + '>'; const closeMarkup = '</' + match[2] + '>';