Skip to content

Custom attributes not working #2

@jplew

Description

@jplew

Hi:

I'm trying to pass <img data-filename="..."> and getting this error:

ErrorException in HTMLDefinition.php line 379:
Attribute 'data-filename' in element 'img' not supported (for information on implementing this, see the support forums)

Here is the relevant part of my config/purifier.php:

'HTML.Allowed'  => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src|style|data-filename]',

In addition, I'm trying to pass a 'style' attribute on my <img> tag. Despite the fact I have also specified 'style' in my HTML.Allowed, the clean() function is stripping out my style attribute. It doesn't give an error message like it does for data-filename, however.

Am I doing something wrong?

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