Type: Function

The mutation hook callback may modify the XML through the provided blueprint and can change the selection by modifying selection according to the needs of the application. It should always return an instance of the MutationHookResult class, indicating the result of the operation. In addition to this result, the changes made to the blueprint should be valid for the mutation to succeed. This validation is automatically performed if the callback returns MutationHookResult.ok().

Many standard mutation primitives are accessible from the fontoxml-base-flow package, which is part of the base platform.

For creation of new elements and other nodes, use the Document node of the targeted document as a factory. See the documentation on createElementNS for more information.

Although the Nodes obtained through the blueprint and selection contain mutation methods, never use these to mutate the XML document directly. Always use the blueprint API.


  1. event


    The event that triggered this mutation hook.

  2. blueprint


    Type: Blueprint

    Blueprints provide a layer over the XML DOM in which changes can be made without affecting the actual document(s).

  3. format


    Type: Format

    Provides access to the schema, including validation.

  4. selection


    The current selection, which can be modified to update the selection resulting from the operation.


The result of this mutation. Return notAllowed() to cancel / disable the operation. If ok() is returned, the operation will still be cancelled / disabled if the changes made to the blueprint are not valid.