Answers.Body: <p>See this config setting: <a href="http://htmlpurifier.org/live/configdoc/plain.html#HTML.AllowedAttributes" rel="nofollow noreferrer">http://htmlpurifier.org/live/configdoc/plain.html#HTML.AllowedAttributes</a></p>
  
  <p>You should be able to use it to allow data attributes.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-05T09:20:55.023Z
Answers.Text: Thanks Clark, I am aware of the settings, however when I try something like this `"HTML.AllowedAttributes": ["img.src", "img.alt", "a.href", "*.title", "*.data"]` I get an error saying `Global attribute '*' is not supported in any elements`. Even if i try to set the attr to an element, it still doesn't allow it `Attribute 'data' in element 'a' not supported`.
  I have also tried adding the `HTML.AllowedElements` setting too, to make sure the tag was allowed, but that made no difference.
Answers.UserDisplayName: zizther
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-05T17:00:45.970Z
Answers.Text: Have you tried just `.data` or `data`
Answers.UserDisplayName: Clark Nelson
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-20T13:29:13.037Z
Answers.Text: Was anyone able to get this to work?
Answers.UserDisplayName: CreateSean
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-27T06:15:56.067Z
Answers.Text: @CreateSean - https://craftcms.stackexchange.com/a/38833/10878
Answers.UserDisplayName: stevecomrie
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-29T15:05:11.573Z
Answers.Text: can confirm that using either ".data" or "data" will not work.
Answers.UserDisplayName: Chad W
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-04T15:39:15.067Z
Answers.LastActivityDate: 2019-09-04T15:39:15.067Z
Answers.UserDisplayName: Clark Nelson
Answers.Body: <p>Found this, which may help someone who is smarter than I am go down a path to solve this: <a href="https://stackoverflow.com/a/29317456/584599">https://stackoverflow.com/a/29317456/584599</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-29T15:11:50.810Z
Answers.LastActivityDate: 2019-10-29T15:11:50.810Z
Answers.UserDisplayName: Chad W
Body: <p>I am looking to allow <code>data</code> attr in tags with Redactor content.</p>
  
  <p>What should I add to the Default config settings to allow this attr?</p>
  
Tags: <redactor>
Title: How to allow data attr in tags in Redactor HTML Purifer
ThreadText: # How to allow data attr in tags in Redactor HTML Purifer
  
  (Asked by: username_0 on 2019-09-04)
  
  I am looking to allow `data` attr in tags with Redactor content.
  
  What should I add to the Default config settings to allow this attr?
  
  **Tags:** redactor
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-09-04. Score: 1
  
  See this config setting: <http://htmlpurifier.org/live/configdoc/plain.html#HTML.AllowedAttributes>
  
  You should be able to use it to allow data attributes.
  
  > **Comments:**
  > **username_0**: Thanks username_1, I am aware of the settings, however when I try something like this `"HTML.AllowedAttributes": ["img.src", "img.alt", "a.href", "*.title", "*.data"]` I get an error saying `Global attribute '*' is not supported in any elements`. Even if i try to set the attr to an element, it still doesn't allow it `Attribute 'data' in element 'a' not supported`. I have also tried adding the `HTML.AllowedElements` setting too, to make sure the tag was allowed, but that made no difference.  
  > **username_1**: Have you tried just `.data` or `data`  
  > **username_4**: can confirm that using either ".data" or "data" will not work.  
  > **username_2**: Was anyone able to get this to work?  
  > **username_3**: @username_2 - https://craftcms.stackexchange.com/a/38833/10878  
  
  ---
  
  ### Answer by username_4 on 2019-10-29. Score: 1
  
  Found this, which may help someone who is smarter than I am go down a path to solve this: <https://stackoverflow.com/a/29317456/584599>
  
  
  ---
  
  