Skip to content

on handling "unknown" elements #158

@mozfreddyb

Description

@mozfreddyb

We've discussed handling unknown elements (e.g. <foo>) in the Sanitizer API.
@otherdaniel Made the point that experience from Trusted Types has shown developers and popular frameworks using them and there needs to be a way to support them.

We can just "detect" custom elements and allow them with the allowCustomElements boolean in the config. We'll continue preventing those unless explicitly enumerated in allowElements and enabled using the boolean above.

Unknown elements can not be detected.
One could infer that an element is truly unknown if it is neither in dropElements or blockElements and explicitly listed by the developer through allowElements.
For now, we've decided that this is OK without an extra boolean switch as unknown elements do not have any semantics unless someone explicitly operates on those elements after creation/insertion. They still need to be listed in allowElements.

The distinction between custom and unknown elements that we've currently made is that a custom element has more "power" and implicit semantics by virtue of inheriting from a potentially function-heavy element that the browser already knows and where the browser is implementing/performing the functionality of the element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions