Skip to content

TypeError: Cannot read property 'mutations' of undefined #87

@antonioribeiro

Description

@antonioribeiro

I believe we have traces of this problem happening in a lot of places, and it should be kind of easy to fix, but maybe not really to understand:

#14
slab/quill#2312
area17/twill#458
slab/quill#889

This error is occurring in Quill when the list of nodes are, somehow, problematic.

This is a simple console.log() of blot.domNode:

image

As you can see the error occurs while processing a <br>, on line 121:

image

Because that line is compiled to

if (blot.domNode[Registry.DATA_KEY].mutations == null) ...

But it could be prevented by just:

if (blot.domNode[Registry.DATA_KEY] && blot.domNode[Registry.DATA_KEY].mutations == null) ...

Because what happens is that this particular node doesn't exists, so a mutation property is, of course, undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions