From bc5085eac037645285e1e7ad6a485d39e9cbee00 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Tue, 12 Aug 2014 18:18:38 -0400 Subject: [PATCH] clarify key uniqueness requirement in docs --- docs/mithril.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/mithril.md b/docs/mithril.md index 5cf22f1a..bf4b3cfe 100644 --- a/docs/mithril.md +++ b/docs/mithril.md @@ -266,7 +266,7 @@ The virtual DOM diffing algorithm has a weakness: a naive diff is not aware of t Fortunately, with Mithril, it's possible for developers to attach an identity key to elements so that array operations like shift, splice and sort only affect the minimum amount of elements required, leaving the rest of the DOM elements untouched when a redraw happens. This allows us to maintain input focus and plugin state correctly. -To maintain the identities of DOM elements, you need to add a `key` property to the direct children of the array that you're planning to modify. The key for each child must be unique among its siblings, but it does not need to be globally unique. Also, keys must be either strings or numbers. +To maintain the identities of DOM elements, you need to add a `key` property to the direct children of the array that you're planning to modify. The key for each child must be unique among a list of sibling DOM elements, but it does not need to be globally unique. Also, keys must be either strings or numbers. ```javascript m("ul", [