1/* 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 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 21module core { 22 23 interface [ 24 CustomMarkFunction, 25 CustomPushEventHandlerScope, 26 CustomToJS, 27 EventTarget, 28 GenerateNativeConverter, 29 InlineGetOwnPropertySlot, 30 Polymorphic 31 ] Node 32#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C 33 : Object, EventTarget 34#endif /* defined(LANGUAGE_OBJECTIVE_C) */ 35 { 36 // NodeType 37 const unsigned short ELEMENT_NODE = 1; 38 const unsigned short ATTRIBUTE_NODE = 2; 39 const unsigned short TEXT_NODE = 3; 40 const unsigned short CDATA_SECTION_NODE = 4; 41 const unsigned short ENTITY_REFERENCE_NODE = 5; 42 const unsigned short ENTITY_NODE = 6; 43 const unsigned short PROCESSING_INSTRUCTION_NODE = 7; 44 const unsigned short COMMENT_NODE = 8; 45 const unsigned short DOCUMENT_NODE = 9; 46 const unsigned short DOCUMENT_TYPE_NODE = 10; 47 const unsigned short DOCUMENT_FRAGMENT_NODE = 11; 48 const unsigned short NOTATION_NODE = 12; 49 50 readonly attribute [ConvertNullStringTo=Null] DOMString nodeName; 51 52 // FIXME: the spec says this can also raise on retrieval. 53 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString nodeValue 54 setter raises(DOMException); 55 56 readonly attribute unsigned short nodeType; 57 readonly attribute Node parentNode; 58 readonly attribute NodeList childNodes; 59 readonly attribute Node firstChild; 60 readonly attribute Node lastChild; 61 readonly attribute Node previousSibling; 62 readonly attribute Node nextSibling; 63 readonly attribute NamedNodeMap attributes; 64 readonly attribute Document ownerDocument; 65 66 [OldStyleObjC, Custom] Node insertBefore(in [Return] Node newChild, 67 in Node refChild) 68 raises(DOMException); 69 [OldStyleObjC, Custom] Node replaceChild(in Node newChild, 70 in [Return] Node oldChild) 71 raises(DOMExceptionJSC); 72 [Custom] Node removeChild(in [Return] Node oldChild) 73 raises(DOMException); 74 [Custom] Node appendChild(in [Return] Node newChild) 75 raises(DOMException); 76 77 boolean hasChildNodes(); 78 Node cloneNode(in boolean deep); 79 void normalize(); 80 81 // Introduced in DOM Level 2: 82 83 [OldStyleObjC] boolean isSupported(in DOMString feature, 84 in [ConvertNullToNullString] DOMString version); 85 86 readonly attribute [ConvertNullStringTo=Null] DOMString namespaceURI; 87 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString prefix 88 setter raises(DOMException); 89 readonly attribute [ConvertNullStringTo=Null] DOMString localName; 90 91 boolean hasAttributes(); 92 93 // Introduced in DOM Level 3: 94 95 readonly attribute [ConvertNullStringTo=Null] DOMString baseURI; 96 97 // FIXME: the spec says this can also raise on retrieval. 98 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString textContent 99 setter raises(DOMException); 100 101 boolean isSameNode(in Node other); 102 boolean isEqualNode(in Node other); 103 [ConvertNullStringTo=Null] DOMString lookupPrefix(in [ConvertNullToNullString] DOMString namespaceURI); 104 boolean isDefaultNamespace(in [ConvertNullToNullString] DOMString namespaceURI); 105 [ConvertNullStringTo=Null] DOMString lookupNamespaceURI(in [ConvertNullToNullString] DOMString prefix); 106 107 // DocumentPosition 108 const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; 109 const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; 110 const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; 111 const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; 112 const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; 113 const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; 114 115 unsigned short compareDocumentPosition(in Node other); 116 117#if 0 118 DOMObject getFeature(in DOMString feature, 119 in DOMString version); 120 DOMUserData setUserData(in DOMString key, 121 in DOMUserData data, 122 in UserDataHandler handler); 123 DOMUserData getUserData(in DOMString key); 124#endif /* 0 */ 125 126 // IE extensions 127 readonly attribute Element parentElement; 128 129#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C 130 // Objective-C extensions 131 readonly attribute boolean isContentEditable; 132#endif /* defined(LANGUAGE_OBJECTIVE_C) */ 133 134#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C 135 [Custom] void addEventListener(in DOMString type, 136 in EventListener listener, 137 in boolean useCapture); 138 [Custom] void removeEventListener(in DOMString type, 139 in EventListener listener, 140 in boolean useCapture); 141 boolean dispatchEvent(in Event event) 142 raises(EventException); 143#endif 144 }; 145 146} 147