From bc532d30bbcdfa195ebc38f21b78e5e339831392 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Mon, 2 Mar 2020 07:51:12 -0500 Subject: [PATCH] docs: describe falsy and nullish attribute behavior --- site/content/docs/02-template-syntax.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index 55b913ca947e..d25b348254db 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -58,6 +58,17 @@ Or they can *be* JavaScript expressions. --- +Boolean attributes are included on the element if their value is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) and excluded if it's [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy). + +All other attributes are included unless their value is [nullish](https://developer.mozilla.org/en-US/docs/Glossary/Nullish) (`null` or `undefined`). + +```html + +
This div has no title attribute
+``` + +--- + An expression might include characters that would cause syntax highlighting to fail in regular HTML, so quoting the value is permitted. The quotes do not affect how the value is parsed: ```html