Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build derived configurations? #64

Closed
otherdaniel opened this issue Feb 19, 2021 · 1 comment
Closed

How to build derived configurations? #64

otherdaniel opened this issue Feb 19, 2021 · 1 comment
Labels
sanitizer-api issues with the API

Comments

@otherdaniel
Copy link
Collaborator

In the current drafts, there is no way to build a configuration based on another one. In order to allow e.g. a single additional custom element on top of the defaults, the developer would need to copy the default config from the spec, add the one lement, and paste that into their app. That seems clumsy.

(And also goes a little against the "ever-green" aspect, in that this might cause outdated defaults to be persisted.)

It might be better to have a way a convenient way to build one config on top of another; in particular on top of the defaults.

@otherdaniel otherdaniel added the sanitizer-api issues with the API label Feb 19, 2021
@otherdaniel
Copy link
Collaborator Author

Alternatives I can think of:

  • Duplicate config properties with add/remove values. E.g., allowElements and addAllowElements.
  • Specify a "parent", plus some semantics on how a config can be merged with the parent to get the effective config.
  • Have some config operators, e.g. mergeConfig(config1, config2).
  • Probably the simplest would be to make configs - at least the default config - accessible as a read-only object, so that devs can build their own derivatives. (E.g. a static Sanitizer.defaultConfigValue, or alternatively a .config attribute on every sanitizer instance.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sanitizer-api issues with the API
Projects
None yet
Development

No branches or pull requests

2 participants