Range.selectNodeContents()

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

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

구문

range.selectNodeContents(referenceNode);

매개변수

referenceNode
Range 로 선택될 내용의 Node 

예제

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

명세

Specification Status Comment
DOM
The definition of 'Range.selectNodeContents()' in that specification.
Living Standard No change.
Document Object Model (DOM) Level 2 Traversal and Range Specification
The definition of 'Range.selectNodeContents()' in that specification.
Obsolete Initial specification.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
selectNodeContentsChrome Full support YesEdge Full support 12Firefox Full support 4IE Full support 9Opera Full support 9Safari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

같이 보기