Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for conditional attributes?

See original GitHub issue
  <div data-something-optional="${nullableValue}"></div>

It can be useful if we get a declarative HTML way to conditionally define an attribute. Thoughts?

cc @sidvishnoi

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

goto-bus-stopcommented, Oct 24, 2019

it looks like it’s missing from the docs, yes. it is definitely a tested and supported feature, though!

saschanazcommented, Dec 3, 2019
<div data-something?="${nullableValue}"></div>

It’ll also avoid a rare but potential clash with having optional in attribute name.

? still is a valid attribute character.

document.createRange().createContextualFragment("<a what?='abc'>").children[0].getAttribute("what?")
// "abc"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Conditional attributes - Kustomer Help Center
Conditional attributes allow you to simplify screen views for agents by only showing attributes that are relevant to their current conversation.
Read more >
Conditional Attributes for Constrained RESTful Environments
A resource marked as Observable in its link description SHOULD support these conditional attributes. Note: In this draft, we assume that ...
Read more >
4 Methods to Add Conditional Attributes to React Components
Using if-else statements is one of the easiest ways to implement conditional attributes. It is pretty much straightforward and readable.
Read more >
ConditionalAttribute Class (System.Diagnostics)
You can apply the ConditionalAttribute attribute to methods and classes. However, its use on classes is valid only for types that are derived...
Read more >
Conditional attributes on variable products -
Hello, I am trying to make a product with 2 attributes: – length – splitting ... separately –
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found