Skip to content

Commit fd7c340

Browse files
authored
refactor(compiler-sfc): replace filter method with for loop (#4905)
1 parent 9c42a1e commit fd7c340

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/compiler-sfc/src/parse.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,11 @@ function hasSrc(node: ElementNode) {
404404
* once the empty text nodes (trimmed content) have been filtered out.
405405
*/
406406
function isEmpty(node: ElementNode) {
407-
return (
408-
node.children.filter(
409-
child => child.type !== NodeTypes.TEXT || child.content.trim() !== ''
410-
).length === 0
411-
)
407+
for (let i = 0; i < node.children.length; i++) {
408+
const child = node.children[i]
409+
if (child.type !== NodeTypes.TEXT || child.content.trim() !== '') {
410+
return false
411+
}
412+
}
413+
return true
412414
}

0 commit comments

Comments
 (0)