2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 // https://dom.spec.whatwg.org/#interface-range
23 // FIXME: All long types in this interface should be unsigned long.
26 ConstructorCallWith
=Document
,
27 WillBeGarbageCollected
,
28 TypeChecking
=Interface,
30 readonly attribute Node startContainer
;
31 readonly attribute
long startOffset
;
32 readonly attribute Node endContainer
;
33 readonly attribute
long endOffset
;
34 readonly attribute
boolean collapsed
;
35 readonly attribute Node commonAncestorContainer
;
37 [RaisesException
] void setStart
(Node node
, long offset
);
38 [RaisesException
] void setEnd
(Node node
, long offset
);
39 [RaisesException
] void setStartBefore
(Node node
);
40 [RaisesException
] void setStartAfter
(Node node
);
41 [RaisesException
] void setEndBefore
(Node node
);
42 [RaisesException
] void setEndAfter
(Node node
);
43 void collapse
(optional boolean toStart
= false
);
44 [RaisesException
] void selectNode
(Node node
);
45 [RaisesException
] void selectNodeContents
(Node node
);
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 [RaisesException
] short compareBoundaryPoints
(unsigned short how
, Range sourceRange
);
53 [RaisesException
, CustomElementCallbacks
] void deleteContents
();
54 [NewObject
, RaisesException
, CustomElementCallbacks
] DocumentFragment extractContents
();
55 [NewObject
, RaisesException
, CustomElementCallbacks
] DocumentFragment cloneContents
();
56 [RaisesException
, CustomElementCallbacks
] void insertNode
(Node node
);
57 [RaisesException
, CustomElementCallbacks
] void surroundContents
(Node newParent
);
59 [NewObject
] Range cloneRange
();
60 [DeprecateAs
=RangeDetach
] void detach
();
62 [RaisesException
] boolean isPointInRange
(Node node
, long offset
);
63 [RaisesException
] short comparePoint
(Node node
, long offset
);
65 [RaisesException
] boolean intersectsNode
(Node node
);
70 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-range-interface
71 // FIXME: getClientRect() and getBoundingClientRect() should
72 // return DOMRectList and DOMRect respectively.
73 ClientRectList getClientRects
();
74 ClientRect getBoundingClientRect
();
76 // DOM Parsing and Serialization
77 // https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#extensions-to-the-range-interface
78 [NewObject
, RaisesException
, CustomElementCallbacks
] DocumentFragment createContextualFragment
(DOMString fragment
);
81 [RaisesException
, DeprecateAs
=RangeExpand
] void expand
([Default=Undefined
] optional DOMString unit
);