Optional attribute support
See original GitHub issueIn some library/wrapper code we need possibility to add attribute value conditionally. Something like this will be really helpfully:
"OptionAttribute" in {
val width = Var(scala.Option.empty[Int])
@dom val td = <td width={width.bind}/>
td.watch()
assert(td.value.outerHTML == "<td/>")
width.value = Some(100)
assert(td.value.outerHTML == "<td width=100/>")
}
But implementation such feature in Binding.scala can broke current code with custom tags
(if somebody uses suggestion from #4 and has property with type like Option[T]
)
@Atry, do you think such Binding.scala feature will be useful? /cc @ccamel
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Optional Attribute (Entity-Relationship Diagram)
The ERD entity consists of required and optional attributes. An optional attribute do not need any value assigned.
Read more >optional - CSS: Cascading Style Sheets - MDN Web Docs
The :optional CSS pseudo-class represents any , , or element that does not have the required attribute set on it.
Read more >Support for XML attributes - IBM
Optional attributes. Attributes can be optional or required and can be associated with any element in a SOAP message or XML for an...
Read more >Use Null Checks for Optional Attributes - Oracle Help Center
If an optional attribute is used in the approval rules, it will lead the server to throw a null pointer exception. The application...
Read more >Manage Custom Attributes (optional) - GoToAssist Remote ...
A standard set of SCIM-based attributes for users – employeeNumber, costCenter, division, and department ... HELP FILE. Manage Custom Attributes (optional).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Implementation is slightly different from the example in this issue: only
Option[String]
is supported, you should useoption:
prefix in an attribute name… please, see test from PR: https://github.com/ThoughtWorksInc/Binding.scala/pull/103/files#diff-1ee69eb8fca397f2ef7f3efd0f631c03I think I understand you. I am going to create PR (unfortunately, an option to assign this task to myself is disabled on this issue).