Skip to content

Commit

Permalink
Fixed a tiny typo in Minimum Virtual DOM.
Browse files Browse the repository at this point in the history
Fixed a tiny typo found in the chapter of Minimum Virtual DOM.

> これまで VNode が持つ小要素の型は(Vnode | string)[]としてきたのですが、
> https://ubugeeei.github.io/chibivue/10-minimum-example/040-minimum-virtual-dom.html#patch-%E9%96%A2%E6%95%B0%E3%81%AE%E5%AE%9F%E8%A3%85%E3%82%92%E8%A1%8C%E3%81%86%E5%89%8D%E3%81%AB
  • Loading branch information
madogiwa0124 committed Dec 17, 2023
1 parent ed1835f commit 0ae3a1c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function h(
}
```

ここからが本筋なのですが、これまで VNode が持つ小要素の型は`(Vnode | string)[]`としてきたのですが、Text を文字列として扱い続けるのもなんなので、VNode に統一してみようと思います。
ここからが本筋なのですが、これまで VNode が持つ子要素の型は`(Vnode | string)[]`としてきたのですが、Text を文字列として扱い続けるのもなんなので、VNode に統一してみようと思います。
Text も実際にはただの文字列ではなく、HTML の TextElement として存在するので、文字列以上の情報を含みます。それらの周辺情報を扱うためにも VNode として扱いたいわけです。
具体的には、Text と言う Symbol を用いて、VNode の type として持たせましょう。
例えば、`"hello"`のようなテキストがあった時、
Expand Down

0 comments on commit 0ae3a1c

Please sign in to comment.