|
Hi Marco, thanks for creating this issue. I think being able to specify additional allowed attributes would be a useful functionality, but I don't fully get the solution you propose. Are you working with specific classes extending Whitelist which you would like to reference like this: @SafeHtml(whitelistClass=MyWhitelist.class)?
The usual way for working with white lists in JSoup seems to be to obtain one of the default lists (as currently exposed via the whitelistType attribute) and then add elements and attributes as required. As you say there is already additionalTags; So maybe it makes sense to provide another option such as additionalTagsWithAttributes which allos to specify allowed attributes and would be used like this:
@SafeHtml(
whitelistType = BASIC,
additionalTags = "simpleTag",
additionalTagsWithAttributes = {
@Tag( name = "div", attributes = { "class", "style" } ),
@Tag( name = "anotherTag", attributes = { "foo", "bar" } )
}
)
private String html;
Would this help your case?
|