|
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/. |
|
5 * |
|
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 |
|
10 * |
|
11 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C |
|
12 * liability, trademark and document use rules apply. |
|
13 */ |
|
14 |
|
15 [Constructor] |
|
16 interface Range { |
|
17 [Throws] |
|
18 readonly attribute Node startContainer; |
|
19 [Throws] |
|
20 readonly attribute unsigned long startOffset; |
|
21 [Throws] |
|
22 readonly attribute Node endContainer; |
|
23 [Throws] |
|
24 readonly attribute unsigned long endOffset; |
|
25 readonly attribute boolean collapsed; |
|
26 [Throws] |
|
27 readonly attribute Node commonAncestorContainer; |
|
28 |
|
29 [Throws] |
|
30 void setStart(Node refNode, unsigned long offset); |
|
31 [Throws] |
|
32 void setEnd(Node refNode, unsigned long offset); |
|
33 [Throws] |
|
34 void setStartBefore(Node refNode); |
|
35 [Throws] |
|
36 void setStartAfter(Node refNode); |
|
37 [Throws] |
|
38 void setEndBefore(Node refNode); |
|
39 [Throws] |
|
40 void setEndAfter(Node refNode); |
|
41 void collapse(optional boolean toStart = false); |
|
42 [Throws] |
|
43 void selectNode(Node refNode); |
|
44 [Throws] |
|
45 void selectNodeContents(Node refNode); |
|
46 |
|
47 const unsigned short START_TO_START = 0; |
|
48 const unsigned short START_TO_END = 1; |
|
49 const unsigned short END_TO_END = 2; |
|
50 const unsigned short END_TO_START = 3; |
|
51 [Throws] |
|
52 short compareBoundaryPoints(unsigned short how, Range sourceRange); |
|
53 [Throws] |
|
54 void deleteContents(); |
|
55 [Throws] |
|
56 DocumentFragment extractContents(); |
|
57 [Throws] |
|
58 DocumentFragment cloneContents(); |
|
59 [Throws] |
|
60 void insertNode(Node node); |
|
61 [Throws] |
|
62 void surroundContents(Node newParent); |
|
63 |
|
64 Range cloneRange(); |
|
65 void detach(); |
|
66 |
|
67 [Throws] |
|
68 boolean isPointInRange(Node node, unsigned long offset); |
|
69 [Throws] |
|
70 short comparePoint(Node node, unsigned long offset); |
|
71 |
|
72 [Throws] |
|
73 boolean intersectsNode(Node node); |
|
74 |
|
75 stringifier; |
|
76 }; |
|
77 |
|
78 // http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment |
|
79 partial interface Range { |
|
80 [Throws] |
|
81 DocumentFragment createContextualFragment(DOMString fragment); |
|
82 }; |
|
83 |
|
84 // http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface |
|
85 partial interface Range { |
|
86 DOMRectList? getClientRects(); |
|
87 DOMRect getBoundingClientRect(); |
|
88 }; |