Knio/dominate

Enable attributes without values

Closed this issue · 2 comments

baloe commented

It seems acceptable to also have attributes without values, e.g. the controls attribute for the video tag:
https://www.w3schools.com/html/html5_video.asp

<video controls> ...

Is this possible with dominate? If so I am unable to figure out how.
If not, how about adding a rule that attribute=None is rendered as an attribute without a value?
Right now attribute=None seems to be equivalent to attribute=False which simply prevents the attribute from being rendered at all.

Note that

<video controls>

is equivalent to

<video controls="controls">
Knio commented

Other users had requested that attribute=None means it should be interpreted the same as not present at all (same as deleted). See previous issues.

As above, attribute=True results in rendering as attribute="attribute", and the HTML spec enforces that to mean the same thing a present with no value.