Skip to content

Deprecation: body‐only‐if

Taylor Hunt edited this page Aug 2, 2019 · 1 revision

Calling a tag with the body-only-if attribute is deprecated in favor of dynamic tagnames.

In order to not render a tag, but to render its body content, pass null for its dynamic tagname.

Here’s a a use-case you may have experienced when making web pages: rendering what’s normally a navigation link as plain text if the user is already where the link points to.

<a body-only-if(input.url === request.url) 
   href=input.url
>
  Body
</a>

The new syntax to achieve this:

<${input.url === request.url ? null : 'a'}
  href=input.url
>
  Body
</>