refactor(compiler-sfc): replace filter method with for loop (#4905)
This commit is contained in:
parent
9c42a1e2a3
commit
fd7c3407c7
@ -404,9 +404,11 @@ function hasSrc(node: ElementNode) {
|
||||
* once the empty text nodes (trimmed content) have been filtered out.
|
||||
*/
|
||||
function isEmpty(node: ElementNode) {
|
||||
return (
|
||||
node.children.filter(
|
||||
child => child.type !== NodeTypes.TEXT || child.content.trim() !== ''
|
||||
).length === 0
|
||||
)
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
const child = node.children[i]
|
||||
if (child.type !== NodeTypes.TEXT || child.content.trim() !== '') {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user