XML DOM deleteContents() method

Definition and usage

The deleteContents() method deletes the area of the document.

Syntax:

deleteContents()

Throw

If the part of the document represented by the current range is read-only, this method will throw a DOMException with the code NO_MODIFICATION_ALLOWED_ERR DOMException exception.

Description

This method will delete all document content represented by the current range. When this method returns, the boundary points of the current range will coincide.

Note:This deletion operation can generate adjacent Text nodes, call Node.normalize() The method can merge these nodes.

Refer to

For methods to copy document content, please refer to Range.cloneContents().

For methods to copy and delete document content, please refer to Range.extractContents().