1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * http://dom.spec.whatwg.org/#range
8 * http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
9 * http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
11 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
12 * liability, trademark and document use rules apply.
16 interface Range : AbstractRange {
21 readonly attribute Node commonAncestorContainer;
23 [Throws, BinaryName="setStartJS"]
24 void setStart(Node refNode, unsigned long offset);
25 [Throws, BinaryName="setEndJS"]
26 void setEnd(Node refNode, unsigned long offset);
27 [Throws, BinaryName="setStartBeforeJS"]
28 void setStartBefore(Node refNode);
29 [Throws, BinaryName="setStartAfterJS"]
30 void setStartAfter(Node refNode);
31 [Throws, BinaryName="setEndBeforeJS"]
32 void setEndBefore(Node refNode);
33 [Throws, BinaryName="setEndAfterJS"]
34 void setEndAfter(Node refNode);
35 [BinaryName="collapseJS"]
36 void collapse(optional boolean toStart = false);
37 [Throws, BinaryName="selectNodeJS"]
38 void selectNode(Node refNode);
39 [Throws, BinaryName="selectNodeContentsJS"]
40 void selectNodeContents(Node refNode);
42 const unsigned short START_TO_START = 0;
43 const unsigned short START_TO_END = 1;
44 const unsigned short END_TO_END = 2;
45 const unsigned short END_TO_START = 3;
47 short compareBoundaryPoints(unsigned short how, Range sourceRange);
49 void deleteContents();
51 DocumentFragment extractContents();
53 DocumentFragment cloneContents();
55 void insertNode(Node node);
57 void surroundContents(Node newParent);
63 boolean isPointInRange(Node node, unsigned long offset);
65 short comparePoint(Node node, unsigned long offset);
68 boolean intersectsNode(Node node);
70 [Throws, BinaryName="ToString"]
74 // http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
75 partial interface Range {
77 DocumentFragment createContextualFragment(DOMString fragment);
80 // http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
81 partial interface Range {
82 DOMRectList? getClientRects();
83 DOMRect getBoundingClientRect();
86 dictionary ClientRectsAndTexts {
87 required DOMRectList rectList;
88 required sequence<DOMString> textList;
91 partial interface Range {
93 ClientRectsAndTexts getClientRectsAndTexts();