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.
|
* once the empty text nodes (trimmed content) have been filtered out.
|
||||||
*/
|
*/
|
||||||
function isEmpty(node: ElementNode) {
|
function isEmpty(node: ElementNode) {
|
||||||
return (
|
for (let i = 0; i < node.children.length; i++) {
|
||||||
node.children.filter(
|
const child = node.children[i]
|
||||||
child => child.type !== NodeTypes.TEXT || child.content.trim() !== ''
|
if (child.type !== NodeTypes.TEXT || child.content.trim() !== '') {
|
||||||
).length === 0
|
return false
|
||||||
)
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user