From 11bced844c756d8718a1b268f6ffb018e160945d Mon Sep 17 00:00:00 2001 From: Barney Carroll Date: Thu, 15 Apr 2021 08:39:41 +0100 Subject: [PATCH] Back out migration ToC, correct references to vnode shape --- docs/migration-v02x.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/migration-v02x.md b/docs/migration-v02x.md index 2bc3775c..035d3da2 100644 --- a/docs/migration-v02x.md +++ b/docs/migration-v02x.md @@ -317,7 +317,7 @@ m.mount(document.body, { ## Component arguments -Arguments to a component in v2.x must be an object, simple values like `String`/`Number`/`Boolean` will be treated as text children. Arguments are accessed within the component by reading them from the `vnode.attrs` object. +Arguments to a component in v2.x must be an object, simple values like `String`/`Number`/`Boolean` will be treated as children. Arguments are accessed within the component by reading them from the `vnode.attrs` object. ### v0.2.x @@ -431,6 +431,20 @@ m("div", "value", ["nested"]) } ``` +If only a single text child is present on a DOM vnode, it instead sets `text` to that value. + +```javascript +m("div", "value") + +// Becomes roughly: +{ + tag: "div", + attrs: null, + text: "", + children: undefined, +} +``` + See [the vnode docs](vnodes.md) for more details on the v2.x vnode structure and how things are normalized. *Most of the v2.x vnode properties here are omitted for brevity.*