RegExp for attribute values - expanding the allowedAttribute interface #707
felixapitzsch
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am going back to an issue raised seven years ago (#203). In reply to the need to restrict allowed values for
allowedAttributes, @boutell proposed a new way to specify anallowedAttibuteas{ name: string; values: string[] } | { name: string; allowed: RegExp | Function }... what I believe was later implemented as
{ name: string; multiple?: boolean | undefined; values: string[] }However, the part with
allowed: RegExp | Functionseems to have never been implemented. Is this correct? I am wondering about the reasons not to implement this, because it is exactly want I am missing right now. 🙂If there are no known downsides to this, I would like to advocate for expanding the
allowedAttributeinterface to include @boutell 's 'allowed' as an alternative into the 'values' property:AllowedAttribute = string | { name: string; multiple?: boolean | undefined; values: ( string | RegExp | Function )[] };... with the meaning that an evaluated attribute value would need to either satisfy the existing values:string/multiple logic or match at least one provided RegExp or make at least one provided function return
true.What are the opinions on this proposal? Any downsides? This interface could even be useful to specify other allowed values, for example for
allowedStyles.Beta Was this translation helpful? Give feedback.
All reactions