Skip to content

surroundContents exception #406

@abraluve

Description

@abraluve

Hi,

my user just found out interesting bug.

editorSetStyle method calls condition selection.rangeCount > 0, then else condition is matched calls

range.surroundContents(element);

which gives exception:

InvalidStateError: Failed to execute 'surroundContents' on 'Range': The Range has partially selected a non-Text node.

HTML to simulate:

<p contenteditable="true" spellcheckker="false">some text: 8<span style="font-weight: bold;">9 points</span>&nbsp;some text</p>

On selecting text "89 points" and applying Bold exception is thrown.

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