Skip to content

nh3.clean() does not support filter_style_properties despite being documented #107

@chrisdellisantirn

Description

@chrisdellisantirn

The docs for nh3.clean() list filter_style_properties as a supported keyword argument. However passing this argument raises an error:

clean() got an unexpected keyword argument 'filter_style_properties'

Inspecting the runtime signature confirms it is not implemented:

(html, tags=None, clean_content_tags=None, attributes=None, attribute_filter=None,
 strip_comments=True, link_rel='noopener noreferrer',
 generic_attribute_prefixes=None, tag_attribute_values=None,
 set_tag_attribute_values=None, url_schemes=None)

So filter_style_properties not available, along with allowed_classes it appears.

As a result, you can enable inline styles but cannot safely constrain them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions