range
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
* Some parts of this feature may have varying levels of support.
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.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
Rangeinto a newNode. Range.compareBoundaryPoints()-
Compares the boundary points of the
Rangewith anotherRange. Range.cloneRange()-
Returns a
Rangeobject with boundary points identical to the clonedRange. Range.detach()-
Releases the
Rangefrom use to improve performance. Range.toString()-
Returns the text of the
Range. Range.compareNode()지원이 중단되었습니다 비표준-
Returns a constant representing whether the
Nodeis before, after, inside, or surrounding the range. Range.comparePoint()Experimental-
Returns -1, 0, or 1 indicating whether the point occurs before, inside, or after the
Range. Range.createContextualFragment()Experimental-
Returns a
DocumentFragmentcreated from a given string of code. Range.getBoundingClientRect()Experimental-
Returns a
ClientRectobject which bounds the entire contents of theRange; this would be the union of all the rectangles returned byrange.getClientRects(). Range.getClientRects()Experimental-
Returns a list of
ClientRectobjects that aggregates the results ofElement.getClientRects()for all the elements in theRange. Range.intersectsNode()Experimental-
Returns a
booleanindicating whether the given node intersects theRange. Range.isPointInRange()Experimental-
Returns a
booleanindicating whether the given point is in theRange.
명세
| Specification |
|---|
| DOM> # interface-range> |
| DOM Parsing and Serialization> # extensions-to-the-range-interface> |
| CSSOM View Module> # extensions-to-the-range-interface> |
브라우저 호환성
Loading…