Skip to content

Wildcard attributes #223

Answered by rgrove
allard asked this question in Q&A
Nov 5, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

The easiest way to achieve this would be to allow all data- attributes. You can do this by adding :data to the list of allowed attributes:

attributes: {
  all: Sanitize::Config::RELAXED[:attributes][:all] + [:data]
}

If you'd rather not allow all arbitrary data- attributes and would instead prefer to only allow attributes beginning with data-bs-, you could do this by writing a custom transformer.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@allard
Comment options

Answer selected by rgrove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #222 on November 05, 2021 03:44.