Range.selectNodeContents()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.

Range.selectNodeContents()Node의 내용을 포함하는 Range를 설정합니다.

부모 Node 의 start, end 값이 Reference가 됩니다. startOffset 은 0이고, endOffset 은 Child Node의 수 혹은 Reference Node에 포함되어 있는 Child Node의 수가 됩니다.

구문

js
range.selectNodeContents(referenceNode);

매개변수

referenceNode

Range 로 선택될 내용의 Node

예제

js
range = document.createRange();
referenceNode = document.getElementsByTagName("div")[0];
range.selectNodeContents(referenceNode);

명세

Specification
DOM
# dom-range-selectnodecontents

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
selectNodeContents

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

같이 보기