Skip to content

Support multiple hooks per hook type #3667

@benedictleejh

Description

@benedictleejh

Currently, only 1 hook per entry point is allowed in configuration. However, DOMPurify actually supports multiple hooks per hook type: https://github.com/cure53/DOMPurify/blob/main/src/purify.ts#L105-L117. The docs for removeHook also reference a stack of hooks, and the code also executes all hooks for a type during sanitisation.

As such, to align with the DOMPurify API, it might be worthwhile to support such a capability.

That said, I will admit there is a very small amount of things that can be done with multiple functions that cannot be done with one (and I will freely admit that I cannot think of one as of the writing of this issue), so the benefit is likely to be limited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions