XML DOM detach() method
Definition and usage
The detach() method releases a Range object.
Syntax:
detach()
Throw
Like all Range methods, if detach() is called on a Range object that has already been released, the method will throw an exception with the code INVALID_STATE_ERR DOMException exception.
Description
The DOM implementation will track all Range objects created for the document, as they need to change the boundary points of the range when modifying the document. Once it is confirmed that the Range object is no longer in use, the detach() method can be called to notify the implementation that it no longer needs to track the range.
Note:Once the detach() method of the Range object has been called, if the Range object is used again, an exception will be thrown.
The call to the detach() method is not necessary, but calling it can improve performance when the document is modified.
The Range object will not be immediately recycled.