-
Notifications
You must be signed in to change notification settings - Fork 655
Deprecation: String as dynamic attribute value
Taylor Hunt edited this page Aug 2, 2019
·
3 revisions
Passing a string as a value for dynamic attributes is deprecated. The examples below use the old <div ${attrs}/>
syntax, but if you’ve run migrations these may use the new ...spread
syntax.
<input ${input.isRequired ? "required" : ""}/>
Instead, use boolean attributes:
<input required=input.isRequired />
ℹ️ Note: For attributes such as aria-expanded
and contenteditable
that are specced to have meaning when their value is "false"
, use the literal string "false"
:
<p aria-expanded="false" contenteditable='false'/>
<div ${`x=${foo} y="bar"`}/>
Instead, use dynamic spread attributes with an object.
<div ...{ x: foo, y: "bar" }/>
To automatically fix deprecated marko syntax, try the marko migrate
command from the CLI.