Skip to content

bug/request- support for boolean attributes #157

@jvanasco

Description

@jvanasco

html attributes can either be name/value pairs OR boolean attributes.

most boolean attributes can be handled by using the key as the value.

e.g. these two are the same

<input type="checkbox" name="foo" value="bar" checked />
<input type="checkbox" name="foo" value="bar" checked="checked" />

some boolean attributes aren't very well documented on how they're interpreted. for example, how schema.org uses itemscope (https://schema.org/docs/gs.html#microdata_itemscope_itemtype)

<div itemscope itemtype="http://schema.org/Movie"></div>

running this through bleach, we would get:

<div itemscope="" itemtype="http://schema.org/Movie"></div>

it would be great to allow bleach to somehow handle boolean attributes.

maybe accept a list of what should be kept as a key-only, and what should be handled as a key="key" pairing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions