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와 관계가 있는Range 의 시작 위치를 설정한다. Range.setStartAfter()(en-US)-
다른
Node와 관계가 있는Range 의 시작 위치를 설정한다. Range.setEndBefore()(en-US)-
다른
Node와 관계가 있는Range 의 끝 위치를 설정한다. Range.setEndAfter()(en-US)-
다른
Node와 관계가 있는Range 의 끝 위치를 설정한다. Range.selectNode()(en-US)-
Range에Node와 그것의 내용물을 포함 시킨다. Range.selectNodeContents()-
Range에Node의 내용물을 포함 시킨다. 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를 삽입한다. Range.surroundContents()(en-US)-
Moves content of a
Rangeinto a newNode. Range.compareBoundaryPoints()(en-US)-
Compares the boundary points of the
Rangewith anotherRange. Range.cloneRange()(en-US)-
Returns a
Rangeobject with boundary points identical to the clonedRange. Range.detach()(en-US)-
Releases the
Rangefrom use to improve performance. Range.toString()(en-US)-
Returns the text of the
Range. Range.compareNode()(en-US) 지원이 중단되었습니다 비표준-
Returns a constant representing whether the
Nodeis 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
DocumentFragmentcreated from a given string of code. Range.getBoundingClientRect()(en-US) Experimental-
Returns a
ClientRectobject which bounds the entire contents of theRange; this would be the union of all the rectangles returned byrange.getClientRects()(en-US). Range.getClientRects()(en-US) Experimental-
Returns a list of
ClientRectobjects that aggregates the results ofElement.getClientRects()for all the elements in theRange. Range.intersectsNode()(en-US) Experimental-
Returns a
booleanindicating whether the given node intersects theRange. Range.isPointInRange()(en-US) Experimental-
Returns a
booleanindicating whether the given point is in theRange.
명세
| 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