Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Unable to use case sensitive attributes and allow empty string attribute's value ( ="" ) #57

Open
dulmi-j opened this issue Jan 20, 2021 · 2 comments

Comments

@dulmi-j
Copy link

dulmi-j commented Jan 20, 2021

Concern 01

Is there any possibility to allow case sensitive attributes with this package along with a config setting.

I have HTML like below and it removes case sensitive attributes even I add the attribute's named categoryType under allowed_attributes for div tag.

Ex:

<div class="custom" categoryType="books"></div>

Sanitizer is returning for above HTML as below.

<div class="custom"></div>

I have debug your library and found it identify the attribute as "categorytype" (all letters are in lower case). But could we have case sensitive attributes ?

Concern 02

Sanitizer package is removing empty strings value of a attribute like below. (="")

Ex:

<a rel="" href="https://github.com/tgalopin/html-sanitizer/">HTML Sanitizer</a>

Sanitizer returns

<a rel href="https://github.com/tgalopin/html-sanitizer/">HTML Sanitizer</a>

But could we have empty string as attribute value. May be we can allow this feature as well with a config setting.
<a rel="" href="https://github.com/tgalopin/html-sanitizer/">HTML Sanitizer</a>

@tgalopin
Copy link
Owner

But could we have case sensitive attributes ?

HTML5 attributes should always be lowercase AFAIK: https://stackoverflow.com/questions/25033268/are-html5-data-attributes-case-insensitive

Sanitizer package is removing empty strings value of a attribute like below. (="")

What's your use case for that? AFAIK, empty values are always for boolean values, which should be fine with no value.

@keywan-ghadami-oxid
Copy link

@dulmi-j I think this should be closed, or the reason should be explained better.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants