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