W3cubDocs

/Web APIs

Range: detach() method

The Range.detach() method does nothing. It used to disable the Range object and enable the browser to release associated resources. The method has been kept for compatibility.

Syntax

js

detach()

Parameters

None.

Return value

None (undefined).

Examples

js

const range = document.createRange();

range.selectNode(document.getElementsByTagName("div").item(0));
range.detach();

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
detach
1Starting in Chrome 37, this method is a no-op and has no effect.
12
1–15Starting in Firefox 15.0, this method is a no-op and has no effect.
9
9Starting in Opera 24, this method is a no-op and has no effect.
1Since August 2015 this method is a no-op in WebKit-based browsers.
4.4Starting in Chrome 37, this method is a no-op and has no effect.
18Starting in Chrome 37, this method is a no-op and has no effect.
4–15Starting in Firefox 15.0, this method is a no-op and has no effect.
10.1Starting in Opera 24, this method is a no-op and has no effect.
1Since August 2015 this method is a no-op in WebKit-based browsers.
1.0Starting in Samsung Internet 3.0, this method is a no-op and has no effect.

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Range/detach