mirror of
https://github.com/danbulant/node-html-parser
synced 2026-06-19 22:51:29 +00:00
speed up
This commit is contained in:
parent
ee97545974
commit
d266fb999a
1 changed files with 7 additions and 6 deletions
|
|
@ -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] + '>';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue