Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML5 summary and details tags #82

Closed
Aterniad opened this issue Dec 27, 2023 · 3 comments
Closed

HTML5 summary and details tags #82

Aterniad opened this issue Dec 27, 2023 · 3 comments

Comments

@Aterniad
Copy link
Contributor

Aterniad commented Dec 27, 2023

Hi!
Once input had <summary> and <details> HTML5 tags I immediately got an error: "Element 'details' is not supported (for information on implementing this, see the support forums)"

As your docs say, I've fixed it in the following way:

class Html5Definition extends \Stevebauman\Purify\Definitions\Html5Definition
{
    public static function apply(\HTMLPurifier_HTMLDefinition $definition)
    {
        parent::apply($definition);
        $definition->addElement('summary', 'Block', 'Flow', 'Common', [
            'open' => 'Bool',
        ]);
        $definition->addElement('details', 'Block', 'Flow', 'Common');
    }
}

Specifications:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details

Would be rather cool to have this working out of box ;)

@stevebauman
Copy link
Owner

Thanks for the info @Aterniad! Would you mind pushing a PR and making these additions to the Html5 definition here?

https://github.com/stevebauman/purify/blob/master/src/Definitions/Html5Definition.php

@binaryfire
Copy link

These fall under Interactive Elements: https://html.spec.whatwg.org/dev/interactive-elements.html. They include summary, details and dialog, all of which need to be added.

@Aterniad I can make this PR if you don't have time.

@stevebauman
Copy link
Owner

This has been released in v6.2.0

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

No branches or pull requests

3 participants