Change data-list attribute to ql-list-item classes #4490
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sanitizers remove the data attributes from HTML to prevent XSS vulnerabilities.
I have noticed Angular sanitizer is removing data attributes, as others can do as well (https://github.com/jitbit/HtmlSanitizer).
The problem is that by losing data attributes, we are also losing the corresponding style.
The only data attributes used in Quill are for list items
<li>
:[data-list]=""
[data-list]="checked"
[data-list]="unchecked"
[data-list]="bullet"
[data-list]="ordered"
Since
class
attribute is not sanitized, I propose to replace thedata-list
attribute with equivalent CSS classes :.ql-list-item
.ql-list-item-checked
.ql-list-item-unchecked
.ql-list-item-bullet
.ql-list-item-ordered
It give the advantage to keep the list items information after sanitizing HTML content (that is a common requirement for rich text editor that produce HTML to show publicly). It also standardizes Quill format management while the list format was the only one depending on data attributes instead of CSS classes.