1/* 2 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 * 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. 9 * 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. 14 * 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. 19 */ 20 21// Introduced in DOM Level 2: 22[ 23 Constructor, 24 ConstructorCallWith=Document 25] interface Range { 26 27 [GetterRaisesException] readonly attribute Node startContainer; 28 [GetterRaisesException] readonly attribute long startOffset; 29 [GetterRaisesException] readonly attribute Node endContainer; 30 [GetterRaisesException] readonly attribute long endOffset; 31 [GetterRaisesException] readonly attribute boolean collapsed; 32 [GetterRaisesException] readonly attribute Node commonAncestorContainer; 33 34 [RaisesException] void setStart([Default=Undefined] optional Node refNode, 35 [Default=Undefined] optional long offset); 36 [RaisesException] void setEnd([Default=Undefined] optional Node refNode, 37 [Default=Undefined] optional long offset); 38 [RaisesException] void setStartBefore([Default=Undefined] optional Node refNode); 39 [RaisesException] void setStartAfter([Default=Undefined] optional Node refNode); 40 [RaisesException] void setEndBefore([Default=Undefined] optional Node refNode); 41 [RaisesException] void setEndAfter([Default=Undefined] optional Node refNode); 42 [RaisesException] void collapse([Default=Undefined] optional boolean toStart); 43 [RaisesException] void selectNode([Default=Undefined] optional Node refNode); 44 [RaisesException] void selectNodeContents([Default=Undefined] optional Node refNode); 45 46 // CompareHow 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 52 [RaisesException] short compareBoundaryPoints([Default=Undefined] optional CompareHow how, 53 [Default=Undefined] optional Range sourceRange); 54 55 [RaisesException, CustomElementCallbacks=Enable] void deleteContents(); 56 [RaisesException, CustomElementCallbacks=Enable] DocumentFragment extractContents(); 57 [RaisesException, CustomElementCallbacks=Enable] DocumentFragment cloneContents(); 58 [RaisesException, CustomElementCallbacks=Enable] void insertNode([Default=Undefined] optional Node newNode); 59 [RaisesException, CustomElementCallbacks=Enable] void surroundContents([Default=Undefined] optional Node newParent); 60 [RaisesException] Range cloneRange(); 61 [RaisesException] DOMString toString(); 62 63 [RaisesException] void detach(); 64 65 // CSSOM View Module API extensions 66 67 ClientRectList getClientRects(); 68 ClientRect getBoundingClientRect(); 69 70 // extensions 71 72 [RaisesException, CustomElementCallbacks=Enable] DocumentFragment createContextualFragment([Default=Undefined] optional DOMString html); 73 74 // WebKit extensions 75 76 [RaisesException] boolean intersectsNode([Default=Undefined] optional Node refNode); 77 78 [RaisesException] short compareNode([Default=Undefined] optional Node refNode); 79 80 // CompareResults 81 const unsigned short NODE_BEFORE = 0; 82 const unsigned short NODE_AFTER = 1; 83 const unsigned short NODE_BEFORE_AND_AFTER = 2; 84 const unsigned short NODE_INSIDE = 3; 85 86 [RaisesException] short comparePoint([Default=Undefined] optional Node refNode, 87 [Default=Undefined] optional long offset); 88 89 [RaisesException] boolean isPointInRange([Default=Undefined] optional Node refNode, 90 [Default=Undefined] optional long offset); 91 92 [RaisesException] void expand([Default=Undefined] optional DOMString unit); 93}; 94 95