-
Notifications
You must be signed in to change notification settings - Fork 668
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'/><img ${`src=${markoLogoUrl} alt="Marko"`}/>Instead, use dynamic spread attributes with an object.
<img ...{ src: markoLogoUrl, alt: "Marko" }/>To automatically fix deprecated marko syntax, try the marko migrate command from the CLI.