dominate icon indicating copy to clipboard operation
dominate copied to clipboard

Enable attributes without values

Open baloe opened this issue 2 years ago • 1 comments

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.

baloe avatar Aug 10 '22 16:08 baloe

Note that

<video controls>

is equivalent to

<video controls="controls">

golightlyb avatar Aug 10 '22 16:08 golightlyb

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.

Knio avatar Aug 20 '22 20:08 Knio