Bug 1861467 - [wpt-sync] Update web-platform-tests to eedf737ce39c512d0ca3471f988972e...
[gecko.git] / dom / webidl / Range.webidl
blob9d06ec09c7829b69e8489bb1bf2106d12e01c3c4
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  */
15 // Use ProbablyShortLivingWrapper so that the Range object could be deleted
16 // as soon as possible, and thus slow down DOM operations less.
17 [Exposed=Window, ProbablyShortLivingWrapper]
18 interface Range : AbstractRange {
19   [Throws]
20   constructor();
22   [Throws]
23   readonly attribute Node commonAncestorContainer;
25   [Throws, BinaryName="setStartJS"]
26   undefined setStart(Node refNode, unsigned long offset);
27   [Throws, BinaryName="setEndJS"]
28   undefined setEnd(Node refNode, unsigned long offset);
29   [Throws, BinaryName="setStartBeforeJS"]
30   undefined setStartBefore(Node refNode);
31   [Throws, BinaryName="setStartAfterJS"]
32   undefined setStartAfter(Node refNode);
33   [Throws, BinaryName="setEndBeforeJS"]
34   undefined setEndBefore(Node refNode);
35   [Throws, BinaryName="setEndAfterJS"]
36   undefined setEndAfter(Node refNode);
37   [BinaryName="collapseJS"]
38   undefined collapse(optional boolean toStart = false);
39   [Throws, BinaryName="selectNodeJS"]
40   undefined selectNode(Node refNode);
41   [Throws, BinaryName="selectNodeContentsJS"]
42   undefined selectNodeContents(Node refNode);
44   const unsigned short START_TO_START = 0;
45   const unsigned short START_TO_END = 1;
46   const unsigned short END_TO_END = 2;
47   const unsigned short END_TO_START = 3;
48   [Throws]
49   short compareBoundaryPoints(unsigned short how, Range sourceRange);
50   [CEReactions, Throws]
51   undefined deleteContents();
52   [CEReactions, Throws]
53   DocumentFragment extractContents();
54   [CEReactions, Throws]
55   DocumentFragment cloneContents();
56   [CEReactions, Throws]
57   undefined insertNode(Node node);
58   [CEReactions, Throws]
59   undefined surroundContents(Node newParent);
61   Range cloneRange();
62   undefined detach();
64   [Throws]
65   boolean isPointInRange(Node node, unsigned long offset);
66   [Throws]
67   short comparePoint(Node node, unsigned long offset);
69   [Throws]
70   boolean intersectsNode(Node node);
72   [Throws, BinaryName="ToString"]
73   stringifier;
76 // http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
77 partial interface Range {
78   [CEReactions, Throws, UseCounter]
79   DocumentFragment createContextualFragment(DOMString fragment);
82 // http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
83 partial interface Range {
84   DOMRectList? getClientRects();
85   DOMRect getBoundingClientRect();
88 dictionary ClientRectsAndTexts {
89   required DOMRectList rectList;
90   required sequence<DOMString> textList;
93 partial interface Range {
94   [ChromeOnly, Throws]
95   ClientRectsAndTexts getClientRectsAndTexts();