/
182.txt
182 lines (160 loc) · 9.27 KB
/
182.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
[1] [CODE(DOMi)[Node]] 界面は、 [[DOM]] で最も重要なデータ型です。
これは文書木中の一つの[RUBY[[[節]]] [ノード]]を表します。
[WEAK[(但し実際的には [CODE(DOM)[Node]] 型そのものの節の実現値は存在せず、 [CODE(DOMi)[Node]] を継承した、例えば [CODE(DOM)[[[Element]]]] 型の節として存在します。)]]
[2] [CODE(DOMi)[Node]] 界面の method などの中には、
特定種類の節に対しては意味を成さないものもあります。
そうしたものは [CODE(DOM)[null]] や例外が返されるかもしれません。
[WEAK[(それぞれ個々の場合ごとに決まっています。)]]
* 継承関係
[13] [CODE(DOMi)@en[[[Node]]]] [[インターフェイス]]は
[CODE(DOMi)@en[[[EventTarget]]]] [[インターフェイス]]を[[継承]]しています。
[14] [CODE(DOMi)@en[[[Node]]]] [[インターフェイス]]を[[継承]]した主たる[[インターフェイス]]として
[CODE(DOMi)@en[[[ParentNode]]]] と [CODE(DOMi)@en[[[ChildNode]]]]
があります。 [[DOM Standard]] で定義されている[[節点]]はすべてこのいずれか(のみ)を[[継承]]しています。
;; [15] この2つは [[DOM Standard]] で追加されたので、 [[DOM3]] 以前はありませんでした。
[[DOM3]] までは [CODE(DOMi)@en[[[Node]]]] を[[継承]]していて今は[[継承]]していない
[CODE(DOMi)@en[[[Attr]]]] と、 [[DOM3]] まではあって今は廃止された
[CODE(DOMi)@en[[[Entity]]]], [CODE(DOMi)@en[[[EntityReference]]]],
[CODE(DOMi)@en[[[Notation]]]], [CODE(DOMi)@en[[[XPathNamespace]]]]、
[[DOMDTDEF]] (非標準) の [CODE(DOMi)@en[[[ElementTypeDefinition]]]],
[CODE(DOMi)@en[[[AttributeDefinition]]]] はどちらも[[継承]]していません。
[[DOM3]] まであって [[DOM Standard]] で廃止された [CODE(DOMi)@en[[[CDATASection]]]]
は [CODE(DOMi)@en[[[Text]]]] を[[継承]]しているので、 (仮に現在もあれば)
[CODE(DOMi)@en[[[ChildNode]]]] を[[継承]]することになります。
* メンバー
,定数群 ,[CODE(DOM)[[[NodeType]]]]:
,定数 ,[CODE(DOM)[ELEMENT_NODE]] := 1 ,要素節 ,[DOM1]
,定数 ,[CODE(DOM)[ATTRIBUTE_NODE]] := 2 ,属性節 ,[DOM1]
,定数 ,[CODE(DOM)[TEXT_NODE]] := 3 ,文節 ,[DOM1]
,定数 ,[CODE(DOM)[CDATA_SECTION_NODE]] := 4 ,文字データ区間節 ,[DOM1]
,定数 ,[CODE(DOM)[ENTITY_REFERENCE_NODE]] := 5 ,実体参照節 ,[DOM1]
,定数 ,[CODE(DOM)[ENTITY_NODE]] := 6 ,実体節 ,[DOM1]
,定数 ,[CODE(DOM)[PROCESSING_INSTRUCTION_NODE]] := 7 ,処理指令節 ,[DOM1]
,定数 ,[CODE(DOM)[COMMENT_NODE]] := 8 ,注釈節 ,[DOM1]
,定数 ,[CODE(DOM)[DOCUMENT_NODE]] := 9 ,文書節 ,[DOM1]
,定数 ,[CODE(DOM)[DOCUMENT_TYPE_NODE]] := 10 ,文書型節 ,[DOM1]
,定数 ,[CODE(DOM)[DOCUMENT_FRAGMENT_NODE]] := 11 ,文書断片節 ,[DOM1]
,定数 ,[CODE(DOM)[NOTATION_NODE]] := 12 ,記法節 ,[DOM1]
,定数 ,200 まで (up to) ,(W3C が予約) ,[DOM2]
,[CODE(DOMa)@en[[[all]]]] ,[CODE(DOMi)@en[[[HTMLElement]]]] ([[WinIE 4]])
,[CODE(DOMa)@en[[[children]]]] ,[CODE(DOMi)@en[[[HTMLElement]]]] ([[WinIE 4]])
,[CODE(DOMm)@en[[[contains]]]] ,[CODE(DOMi)@en[[[HTMLElement]]]] ([[WinIE 4]])
,[CODE(DOMa)@en[[[document]]]] ,[CODE(DOMi)@en[[[HTMLElement]]]] ([[WinIE 4]])
,読取専用属性 ,[CODE(DOMa)[[[nodeName]]]] ,節名 ,[DOM1]
,読取専用属性 ,[CODE(DOMa)[[[localName]]]] ,局部名 ,[DOM2]
,読取専用属性 ,[CODE(DOMa)[[[namespaceURI]]]] ,名前空間名 ,[DOM2]
,属性 ,[CODE(DOMa)[[[prefix]]]] ,名前空間接頭辞 ,[DOM2]
,属性 ,[CODE(DOMa)[[[nodeValue]]]] ,節値 ,[DOM1]
,読取専用属性 ,[CODE(DOMa)[[[nodeType]]]] ,節型 ,[DOM1]
,読取専用属性 ,[CODE(DOMa)[[[parentNode]]]] ,親節 ,[DOM1]
,読取専用属性 ,[CODE(DOMa)[[[childNodes]]]] ,子節達 ,[DOM1]
,[CODE(DOMa)@en[[[children]]]] ,[CODE(DOMi)@en[[[HTMLElement]]]] ([[Trident]])
,読取専用属性 ,[CODE(DOMa)[[[firstChild]]]] ,最初の子節 ,[DOM1]
,読取専用属性 ,[CODE(DOMa)[[[lastChild]]]] ,最後の子節 ,[DOM1]
,読取専用属性 ,[CODE(DOMa)[[[previousSibling]]]] ,すぐ兄の節 ,[DOM1]
,[CODE(DOMm)@en[[[parentElement]]]] ,[CODE(DOMi)@en[[[HTMLElement]]]] ([[WinIE 4]])
,読取専用属性 ,[CODE(DOMa)[[[nextSibling]]]] ,すぐ弟の節 ,[DOM1]
,読取専用属性 ,[CODE(DOMa)[[[attributes]]]] ,属性達 ,[DOM1]
,読取専用属性 ,[CODE(DOMa)[[[ownerDocument]]]] ,所属文書 ,"[DOM1], [DOM2]"
,method ,[CODE(DOMm)[[[insertBefore]]]] ,直前に節挿入 ,[DOM1]
,method ,[CODE(DOMm)[[[replaceChild]]]] ,子節を置換 ,[DOM1]
,method ,[CODE(DOMm)[[[removeChild]]]] ,子節を削除 ,[DOM1]
,[CODE(DOMm)@en[[[swapNode]]]] ,[CODE(DOMi)@en[[[DOMNode]]]] ([[Trident]])
,method ,[CODE(DOMm)[[[appendChild]]]] ,子節を付加 ,[DOM1]
,method ,[CODE(DOMm)[[[hasChildNodes]]]] ,子節を持つか ,[DOM1]
,method ,[CODE(DOMm)[[[hasAttributes]]]] ,属性を持つか ,[DOM2]
,method ,[CODE(DOMm)[[[cloneNode]]]] ,節を複製 ,[DOM1]
,method ,[CODE(DOMm)[[[normalize]]]] ,正規化 ,[DOM2]
,method ,[CODE(DOMm)[[[isSupported]]]] ,機能対応有無 ,[DOM2]
- [DOM1] ''Document Object Model (Core) Level 1'' <http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-1950641247>
- [DOM2] ''Document Object Model Core'' <http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247>
- [3] [CODE(DOM)[Node]] の集まりの型として、 [CODE(DOM)[[[NodeList]]]] と [CODE(DOM)[[[NamedNodeMap]]]] があります。
- [4] Method [CODE(DOMm)[normalize]] は、 DOM 1
では界面 [CODE(DOMi)[[[Element]]]] で定義されていたものが DOM 2
で移動してきました。
- [5] >>4 属性節で使えないのは不便だしね。てかそれだけ?
- [6] >>5 他の一部の節にしか適用できないのが [CODE(DOMi)[Node]] で定義されている ([CODE(DOMa)[nodeValue]] とか。) のを見ると、どうやら複数の継承先で定義するよりはまとめて単一の継承元で定義しとこうという考えなのでしょう。
[7]
[PRE[
Interface NodeExtended
Attributes
isBlankNode of type boolean
Whether the node is blank or not.
@@ What is _blank_? How different from "hasChildNodes"?
Source: PHP
offset of type long
The child index of the node within its parent.
(?? If the node does not have a parent,
"-1" is returned. If the node is the
first child, "0" is returned. ??)
Source: eDOM
parentElement of type Element
Nearest ancestor or self node which is an element node.
(?? If there is no ancestor or self node whose
type is element, the value is "null". ??)
(?? For Attr, ? is returned. ??)
Source: WinIE, Safari, eDOM
removeChildOnly
Replaces a child node by its children. In other word,
removes a node but not the descendants of that node.
Source: eDOM [defined for Element]
Parameters
oldChild of type Node
A node to remove.
Return Value
Node "oldChild" is returned.
Exceptions
DOMException HIERARCHY_ERR, NO_MODIFICATION_ALLOWED_ERR
replaceChildOnly
Replaces a child node by another node and moves
the children of the original node into the new node.
Attributes of the original node are copied to
the new one if the nodes are elements.
(?? oldChild and newChild is different type ??)
Source: eDOM [defined for Element]
Parameters
oldChild of type Node
Child node to replace.
(?? childToReplace in eDOM ??)
newChild of type Node
New child node to replace by.
(?? newChildName (XHTML local element type name)
of type DOMString in eDOM ??)
Methods
addNamespace
Adds a namespace declaration attribute to a node.
@@ What if already exist? overwrites?
Source: PHP
Parameters
namespaceURI of type DOMString
prefix of type DOMString
No Return Value
descendant
Returns whether a node is ancestor of the node.
Source: eDOM
Parameters
possibleAncestor of type Node
A node that could be the ancestor of this node.
(?? eDOM restricts to "element node". ??)
Return Value
boolean "true" if "possibleAncestor" is the
ancestor of this node; "false" otherwise.
(?? "false" if "possibleAncestor" is
this node itself. ??)
No Exceptions
]PRE]
[8] [CITE[IE6 はノードに追加したオレオレプロパティが消せない(delete document.body.hoge が出来ない) - latest log]]
([TIME[2010-01-01 12:50:06 +09:00]] 版)
<http://d.hatena.ne.jp/uupaa/20090924/1253734273>
[9] [CITE@EN[XML Path Language (XPath) 2.0 (Second Edition)]]
( ([TIME[2011-01-05 01:25:51 +09:00]] 版))
<http://www.w3.org/TR/2010/REC-xpath20-20101214/#dt-node>
[10] [CITE@EN[XQuery 3.0: An XML Query Language]]
( ([TIME[2014-04-08 08:26:21 +09:00]] 版))
<http://www.w3.org/TR/xquery-30/#dt-node>
[11] [CITE@EN[XML Path Language (XPath) 3.0]]
( ([TIME[2014-04-08 07:58:50 +09:00]] 版))
<http://www.w3.org/TR/xpath-30/#dt-node>
[12] [CITE@en[XQuery and XPath Data Model 3.0]]
( ([TIME[2014-04-08 07:00:06 +09:00]] 版))
<http://www.w3.org/TR/xpath-datamodel-3/#Node>