From 392bdc6b109727eb0f80d2eaf3770f947b27089c Mon Sep 17 00:00:00 2001 From: Alfred Ringstad Date: Wed, 31 Mar 2021 19:37:14 +0200 Subject: [PATCH] Add documentation --- site/content/docs/02-template-syntax.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index 0e0e8e4008..6221dfe124 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -1461,6 +1461,28 @@ If `this` is falsy, no component is rendered. ``` +### `` + +```sv + +``` + +--- + +The `` element lets you render an element of a dynamically specified type. This is useful for example when rich text content from a CMS. If the tag is changed, the children will be preserved unless there's a transition attached to the element. Any properties and event listeners present will be applied to the element. + +The only supported binding is `bind:this`, since the element type specific bindings that Svelte does at build time (e.g. `bind:value` for input elements) does not work with a dynamic tag type. + +If `tag` has a nullish value, a warning will be logged in development mode. + +```sv + + +Foo +``` ### ``