이 번역은 완료되지 않았습니다. 이 문서를 번역해 주세요.

Range 객체는 주어진 document 내의 텍스트 노드들의 부분들(parts)과 document의 단편화에 포함된 노드들을 나타내고 있다.

Range 오브젝트는 Document 객체에 포함되어 있는 createRange 메소드를 사용하여 생성할 수 있다. 또한 selection 객체에 포함되어 있는 getRangeAt 메소드를 사용하여 추출할 수 있다.

Range() 생성자 또한 사용 가능하다.

속성

collapsed
Range의 시작점과 끝점이 같인 위치인지를 알 수 있는 boolean 값을 반환한다.
commonAncestorContainer
startContainer와 endContainer 노드들을 포함한 최상위 노드를 반환한다.
endContainer
Range의 끝 위치를 포함하는 Node를 반환한다.
endOffset
endContainer 안에 있는 Range 끝을 나타내는 숫자(offset)를 반환한다.
startContainer
Range의 시작 위치를 포함하는 Node를 반환한다.
startOffset
startContainer 안에 있는 Range 시작을 나타내는 숫자(offset)를 반환한다.

생성자

Range()
Range 객체의 시작과 끝에 따라 전역 Document 와 함께 Range 객체를 반환한다.

메서드

상속한 메서드는 없다.

Range.setStart()
Range 의 시작 위치를 설정한다.
Range.setEnd()
Range 의 끝 위치를 설정한다.
Range.setStartBefore()
다른 Node 와 관계가 있는 Range 의 시작 위치를 설정한다.
Range.setStartAfter()
다른 Node 와 관계가 있는 Range 의 시작 위치를 설정한다.
Range.setEndBefore()
다른 Node 와 관계가 있는 Range 의 끝 위치를 설정한다.
Range.setEndAfter()
다른 Node 와 관계가 있는 Range 의 끝 위치를 설정한다.
Range.selectNode()
Range 에 Node 와 그것의 내용물을 포함 시킨.
Range.selectNodeContents()
Range 에 Node 의 내용물을 포함 시킨.
Range.collapse()
Range 의 경계 지점 중 하나로 영역을 붕괴 시킨다.
Range.cloneContents()
Range 의 노드들을 복사하여 DocumentFragment 를 반환한다.
Range.deleteContents()
Document 로 부터 Range 의 컨텐츠들을 삭제한다.
Range.extractContents()
Document 트리로 부터 Range 의 컨텐츠들을 domxref("DocumentFragment") }} 로 이동시킨다.
Range.insertNode()
Range 의 맨 앞에 Node를 삽입한다.
Range.surroundContents()
Moves content of a Range into a new Node.
Range.compareBoundaryPoints()
Compares the boundary points of the Range with another Range.
Range.cloneRange()
Returns a Range object with boundary points identical to the cloned Range.
Range.detach()
Releases the Range from use to improve performance.
Range.toString()
Returns the text of the Range.
Range.compareNode()
Returns a constant representing whether the Node is before, after, inside, or surrounding the range.
Range.comparePoint()
Returns -1, 0, or 1 indicating whether the point occurs before, inside, or after the Range.
Range.createContextualFragment()
Returns a DocumentFragment created from a given string of code.
Range.getBoundingClientRect()
Returns a ClientRect object which bounds the entire contents of the Range; this would be the union of all the rectangles returned by range.getClientRects().
Range.getClientRects()
Returns a list of ClientRect objects that aggregates the results of Element.getClientRects() for all the elements in the Range.
Range.intersectsNode()
Returns a boolean indicating whether the given node intersects the Range.
Range.isPointInRange()
Returns a boolean indicating whether the given point is in the Range.

명세

Specification Status Comment
DOM
The definition of 'Range' in that specification.
Living Standard Do not use RangeException anymore, use DOMException instead.
Made the second parameter of collapse() optional.
Added the methods isPointInRange(), comparePoint(), and intersectsNode().
Added the constructor Range().
DOM Parsing and Serialization
The definition of 'Extensions to Range' in that specification.
Working Draft Added the method createContextualFragment().
CSS Object Model (CSSOM) View Module
The definition of 'Extensions to Range' in that specification.
Working Draft Added the methods getClientRects() and getBoundingClientRect().
Document Object Model (DOM) Level 2 Traversal and Range Specification
The definition of 'Range' in that specification.
Obsolete Initial specification.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
RangeChrome Full support YesEdge Full support YesFirefox Full support 4
Notes
Full support 4
Notes
Notes Starting with Firefox 13, the Range object throws a DOMException as defined in DOM 4, instead of a RangeException defined in prior specifications.
IE Full support 9Opera Full support 9Safari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4
Notes
Full support 4
Notes
Notes Starting with Firefox 13, the Range object throws a DOMException as defined in DOM 4, instead of a RangeException defined in prior specifications.
Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?
Range() constructor
Experimental
Chrome Full support YesEdge Full support YesFirefox Full support 24IE No support NoOpera Full support 15Safari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 24Opera Android Full support 14Safari iOS Full support YesSamsung Internet Android ?
cloneContentsChrome 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 ?
cloneRangeChrome 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 ?
collapseChrome 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 ?
collapsedChrome 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 ?
commonAncestorContainerChrome 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 ?
compareBoundaryPointsChrome 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 ?
compareNode
ExperimentalDeprecatedNon-standard
Chrome No support NoEdge ? Firefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android ?
comparePoint
Experimental
Chrome Full support YesEdge Full support 17Firefox Full support YesIE No support NoOpera Full support 15Safari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support 14Safari iOS Full support YesSamsung Internet Android ?
createContextualFragment
Experimental
Chrome Full support YesEdge Full support 12Firefox Full support YesIE Full support 11Opera Full support 15Safari Full support 9WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support 14Safari iOS Full support YesSamsung Internet Android ?
deleteContentsChrome 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 ?
detachChrome Full support Yes
Notes
Full support Yes
Notes
Notes Since April 2014 this method is a no-op in Chrome.
Edge Full support 12Firefox No support 4 — 15
Notes
No support 4 — 15
Notes
Notes Starting in Firefox 15.0, this method is a no-op and has no effect.
IE Full support 9Opera Full support 9Safari Full support Yes
Notes
Full support Yes
Notes
Notes Since August 2015 this method is a no-op in WebKit-based browsers.
WebView Android Full support YesChrome Android Full support YesFirefox Android No support 4 — 15
Notes
No support 4 — 15
Notes
Notes Starting in Firefox 15.0, this method is a no-op and has no effect.
Opera Android Full support YesSafari iOS Full support Yes
Notes
Full support Yes
Notes
Notes Since August 2015 this method is a no-op in WebKit-based browsers.
Samsung Internet Android ?
endContainerChrome 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 ?
endOffsetChrome 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 ?
extractContentsChrome 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 ?
getBoundingClientRect
Experimental
Chrome Full support YesEdge Full support 12Firefox Full support 4IE Full support 9Opera Full support 15Safari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support 14Safari iOS Full support YesSamsung Internet Android ?
getClientRects
Experimental
Chrome Full support YesEdge Full support 12Firefox Full support 4IE Full support 9Opera Full support 15Safari Full support 5WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support 14Safari iOS Full support YesSamsung Internet Android ?
insertNodeChrome 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 10.1Safari iOS Full support YesSamsung Internet Android ?
intersectsNode
Experimental
Chrome Full support YesEdge Full support 17Firefox Full support 17IE No support NoOpera Full support 15Safari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 19Opera Android Full support 14Safari iOS Full support YesSamsung Internet Android ?
isPointInRange
Experimental
Chrome Full support YesEdge Full support 15Firefox Full support YesIE No support NoOpera Full support 15Safari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support 14Safari iOS Full support YesSamsung Internet Android ?
selectNodeChrome 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 ?
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 ?
setEndChrome 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 ?
setEndAfterChrome 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 ?
setEndBeforeChrome 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 ?
setStartChrome 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 ?
setStartAfterChrome 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 ?
setStartBeforeChrome 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 ?
startContainerChrome 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 ?
startOffsetChrome 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 ?
surroundContentsChrome 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 ?
toStringChrome Full support YesEdge Full support YesFirefox 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
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.

같이 보기

문서 태그 및 공헌자

태그: 
최종 변경자: alattalatta,