range

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

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

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

속성

collapsed

Range의 시작점과 끝점이 같인 위치인지를 알 수 있는 boolean 값을 반환한다.

commonAncestorContainer

startContainer와 endContainer 노드들을 포함한 최상위 노드를 반환한다.

endContainer

Range의 끝 위치를 포함하는 Node를 반환한다.

endOffset

endContainer 안에 있는 Range 끝을 나타내는 숫자(offset)를 반환한다.

startContainer

Range의 시작 위치를 포함하는 Node를 반환한다.

startOffset

startContainer 안에 있는 Range 시작을 나타내는 숫자(offset)를 반환한다.

생성자

Range() (en-US) Experimental

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

메서드

상속한 메서드는 없다.

Range.setStart() (en-US)

Range 의 시작 위치를 설정한다.

Range.setEnd() (en-US)

Range 의 끝 위치를 설정한다.

Range.setStartBefore() (en-US)

다른 Node (en-US) 와 관계가 있는 Range 의 시작 위치를 설정한다.

Range.setStartAfter() (en-US)

다른 Node (en-US) 와 관계가 있는 Range 의 시작 위치를 설정한다.

Range.setEndBefore() (en-US)

다른 Node (en-US) 와 관계가 있는 Range 의 끝 위치를 설정한다.

Range.setEndAfter() (en-US)

다른 Node (en-US) 와 관계가 있는 Range 의 끝 위치를 설정한다.

Range.selectNode() (en-US)

RangeNode (en-US) 와 그것의 내용물을 포함 시킨.

Range.selectNodeContents()

RangeNode (en-US) 의 내용물을 포함 시킨.

Range.collapse() (en-US)

Range 의 경계 지점 중 하나로 영역을 붕괴 시킨다.

Range.cloneContents() (en-US)

Range 의 노드들을 복사하여 DocumentFragment 를 반환한다.

Range.deleteContents() (en-US)

Document 로 부터 Range 의 컨텐츠들을 삭제한다.

Range.extractContents() (en-US)

Document 트리로 부터 Range 의 컨텐츠들을 domxref("DocumentFragment") }} 로 이동시킨다.

Range.insertNode() (en-US)

Range 의 맨 앞에 Node (en-US)를 삽입한다.

Range.surroundContents() (en-US)

Moves content of a Range into a new Node (en-US).

Range.compareBoundaryPoints() (en-US)

Compares the boundary points of the Range with another Range.

Range.cloneRange() (en-US)

Returns a Range object with boundary points identical to the cloned Range.

Range.detach() (en-US)

Releases the Range from use to improve performance.

Range.toString() (en-US)

Returns the text of the Range.

Range.compareNode() (en-US) 지원이 중단되었습니다 비표준

Returns a constant representing whether the Node (en-US) is before, after, inside, or surrounding the range.

Range.comparePoint() (en-US) Experimental

Returns -1, 0, or 1 indicating whether the point occurs before, inside, or after the Range.

Range.createContextualFragment() (en-US) Experimental

Returns a DocumentFragment created from a given string of code.

Range.getBoundingClientRect() (en-US) Experimental

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() (en-US).

Range.getClientRects() (en-US) Experimental

Returns a list of ClientRect objects that aggregates the results of Element.getClientRects() for all the elements in the Range.

Range.intersectsNode() (en-US) Experimental

Returns a boolean indicating whether the given node intersects the Range.

Range.isPointInRange() (en-US) Experimental

Returns a boolean indicating whether the given point is in the Range.

명세

Specification
DOM Standard
# interface-range
DOM Parsing and Serialization
# extensions-to-the-range-interface
CSSOM View Module
# extensions-to-the-range-interface

브라우저 호환성

BCD tables only load in the browser

같이 보기