Skip to content

Commit

Permalink
docs: 가상돔 오류코드 수정 [deploy]
Browse files Browse the repository at this point in the history
  • Loading branch information
JunilHwang committed Sep 3, 2024
1 parent 244d5c7 commit 62c2f29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Javascript/Design/Vanilla-JS-Virtual-DOM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,8 @@ function updateElement (parent, newNode, oldNode) {
const index = [ ...parent.childNodes ].indexOf(oldNode);
return (
oldNode.remove(),
parent.appendChild(newNode, index)
); // undefined를 반환할 것이다.
parent.insertBefore(newNode, parent.children[index] || null)
); // undefined를 반환할 것이다.
}

// 5. oldNode와 newNode의 태그 이름(type)이 같을 경우
Expand Down Expand Up @@ -957,7 +957,7 @@ function updateElement (parent, newNode, oldNode) {
if (newNode.nodeName !== oldNode.nodeName) {
const index = [ ...parent.childNodes ].indexOf(oldNode);
oldNode.remove();
parent.appendChild(newNode, index);
parent.insertBefore(newNode, parent.children[index] || null);
return;
}
updateAttributes(oldNode, newNode);
Expand Down

0 comments on commit 62c2f29

Please sign in to comment.