ezyang / ezyang/htmlpurifier

OL reversed boolean attr

Open
#468 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.4k
Forks
361
Avg merge
3d 41m
Merged PRs (30d)
2

Description

I use a DJOT template of

{reversed=reversed}
1. Last place: This person
1. Another place: xxx
1. First place: xxx

And that sets the attr into

<ol reversed="reversed">
<li>
Last place: This person
</li>
<li>
Another place: xxx
</li>
<li>
First place: xxx
</li>
</ol>

Which is valid and works in all browsers:
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ol#reversed

But htmlpurifier emits warnings:

Warning (512) : Attribute 'reversed' in element 'ol' not supported (for information on implementing this, see the support forums) [in /shared/httpd/sandbox/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLDefinition.php, line 372]

I believe that's a bug.

Both shorthand <ol reversed> and <ol reversed="reversed"> etc should be valid.
I used this list:

$config->set('HTML.Allowed', '...,ul[class],ol[start|type|reversed],li');

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in library/HTMLPurifier/HTMLDefinition.php around line 372, where the unsupported reversed attribute warning is emitted. Review how the HTML.Allowed setting handles ol[start|type|reversed] and compare it with the HTML standard examples in the issue. Done means both reversed shorthand and reversed="reversed" are accepted without warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.