Skip to content

Unable to set "standalone" boolean attributes #516

@jekru

Description

@jekru

1. Description

I am unable to set "standalone" boolean attributes. Getting the value of these attributes results in an empty string. Also setting such attributes is only possible by using a string. While this is not false because only the presence of the attribute matters, I find it a bit odd to use empty strings to set such attributes. For example checked will be true for <input type="checkbox" checked /> and <input type="checkbox" checked="" /> and even for <input type="checkbox" checked="false" /> because only the presence of the attribute matters.

See also: Boolean attribute (HTML).

2. Exception

There is no exception.

3. Fiddle or Project

https://dotnetfiddle.net/r7jvX7

4. Any further technical details

Creating Attributes.Add(string name, bool value) and SetAttributeValue(string name, bool value) could help differentiate between standalone boolean attributes and attributes with a boolean string to allow creating standalone boolean attributes.

  • HAP Version 1.11.53
  • NET Version 7

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions