处理注释
const processCommentNode = (n1, n2, container, anchor) => {
if (n1 == null) {
hostInsert(
(n2.el = hostCreateComment(n2.children || '')),
container,
anchor
)
} else {
// there's no support for dynamic comments
n2.el = n1.el
}
}
总结:
- 新增:创建一个注释节点到
container
,指向新节点n2
的el
- 更新:新节点的 el 指向老节点的 el