-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Configuration edge cases #198
Comments
Block vs. drop vs. allowSee my comment in #199 Attributes for specific element and for all elementsWe need the ability to allow (or block) attributes either for all elements, or only for specific elements. E.g. I might want to work with an allow list, but allow the Repeated element specsIf the author lists an element multiple times in an allow list, I would merge the lists. E.g. |
This should be answered by #199, I believe |
@otherdaniel can this be closed? |
In the last meeting, and in discussing #196, a number of interesting edge cases came up, where it's unclear how to handle them. There didn't seem to be any strong opinions on what the best solutions might be; but we'll need to agree on some mode for compatibility.
Mixing allow w/ block and drop
In the meeting, the preferred interpretation was that this would allow only "b" elements. The second would allow "b", and preserve text children of "a" and "c".
(The rule implied here would be that all clauses are processed: Even if
allowElements
allows an element, an additionalblockElements
might still block it.)Repeating clauses for the same element
The previous design used dictionaries which have only one entry per key. This has changed to arrays. Now there can be multiple entries for the same element. This gets interesting with attributes that depend on the element.
This could mean:
In the meeting we weren't sure, with a mild preference emerging for the second choice.
Block-clauses with element-dependent attributes.
Does a blockElements-clause with attributes block the element, too, or only the attributes?
Does this allow element "a" or not? Would
<a b="1" c="2">
result in<a c="2">
, or in an empty sub-tree?null and undefined attributes.
Are these the same?
Debuggability, testability, and introspection
Mario raised the point that - especially if the rules aren't entirely obvious - we should add something to let developers write meaningful tests for their configs.
A good way to add this might be to define a 'normalized' config in the spec, and return a normalized config to the developer. Proposed properties of the 'normal config' could be:
1, always use name + namespace, and
2, at most one clause for each element or attribute name, and
3, based on an allow-list, and
4, remove entries not allowed by the default config.
In other words: Resolve short forms + namespaces; resolve duplicate clauses for any element or attribute; and resolve the default config (for block/drop-clauses).
The idea of 4 is to e.g. remove "script" from
allowElements
. But since the config can now be used for bothsetHTML
andsetHTMLUnsafe
, maybe the normalized-config-getter needs two variants, too.The text was updated successfully, but these errors were encountered: