Open ghost opened 2 years ago
I'd like something like this too.
It is great to have the listener support, but without more detail, it is difficult to easily pinpoint exactly why something was discarded, especially for larger content.
This is less important when an element or attribute is rejected outright.
But when an attribute is rejected due to its value, it would be nice to know what that rejected value was.
A good example of this is when an a
element's href
attribute is rejected due to an invalid protocol.
If there is a reason why including rejected values might not be a good idea, an alternative might be to share the row/col offset (from original content) of where the issue occurred with the listener.
As I'm using java-html-sanitizer more it is occurring to me, at least in my current usage, that knowing the discarded value/content is only helpful when the item being rejected is rejected due to its content/value.
If an element or attribute is rejected outright (not due to its value/content), knowing its value/content does not add information.
In my current usage, only attributes are rejected due to their value.
Something like the following would be really nice: