1 |
wakaba |
1.1 |
#!/usr/bin/perl |
2 |
|
|
## This file is automatically generated |
3 |
wakaba |
1.15 |
## at 2006-12-30T08:09:39+00:00, |
4 |
wakaba |
1.12 |
## from file "Document.dis", |
5 |
wakaba |
1.1 |
## module <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.Document>, |
6 |
wakaba |
1.15 |
## for <http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#all>. |
7 |
wakaba |
1.1 |
## Don't edit by hand! |
8 |
|
|
use strict; |
9 |
|
|
require Message::DOM::DOMCore; |
10 |
|
|
require Message::DOM::TreeCore; |
11 |
|
|
require Message::Util::Error::DOMException; |
12 |
|
|
package Message::DOM::Document; |
13 |
wakaba |
1.15 |
our $VERSION = 20061230.0809; |
14 |
wakaba |
1.10 |
package Message::DOM::Document::ManakaiDOMImplementationDocument; |
15 |
wakaba |
1.15 |
our $VERSION = 20061230.0809; |
16 |
wakaba |
1.10 |
push @Message::DOM::DOMCore::ManakaiDOMImplementation::ISA, q<Message::DOM::Document::ManakaiDOMImplementationDocument> unless Message::DOM::DOMCore::ManakaiDOMImplementation->isa (q<Message::DOM::Document::ManakaiDOMImplementationDocument>); |
17 |
|
|
sub create_document ($;$$$) { |
18 |
|
|
my ($self, $namespaceURI, $qualifiedName, $doctype) = @_; |
19 |
|
|
|
20 |
|
|
{ |
21 |
|
|
|
22 |
|
|
if |
23 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
24 |
|
|
require Message::DOM::DOMMain; |
25 |
|
|
|
26 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:1167465382:17798:gAilE14884'; |
27 |
wakaba |
1.10 |
|
28 |
|
|
; |
29 |
|
|
|
30 |
wakaba |
1.15 |
$namespaceURI = undef; |
31 |
wakaba |
1.10 |
} |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
} |
35 |
|
|
my $r; |
36 |
|
|
|
37 |
|
|
{ |
38 |
|
|
|
39 |
wakaba |
1.14 |
require |
40 |
|
|
Scalar::Util; |
41 |
|
|
$r = bless \{ |
42 |
wakaba |
1.10 |
|
43 |
wakaba |
1.13 |
'child' |
44 |
|
|
=> [], |
45 |
wakaba |
1.10 |
|
46 |
wakaba |
1.13 |
'impl' |
47 |
|
|
=> $self, |
48 |
wakaba |
1.10 |
|
49 |
wakaba |
1.13 |
'http://www.w3.org/2001/04/infoset#version' |
50 |
|
|
=> '1.0', |
51 |
wakaba |
1.10 |
|
52 |
wakaba |
1.13 |
'chk' |
53 |
|
|
=> 1, |
54 |
wakaba |
1.14 |
}, |
55 |
wakaba |
1.13 |
'Message::DOM::Document::ManakaiDOMDocument' |
56 |
wakaba |
1.10 |
; |
57 |
|
|
|
58 |
|
|
if (defined $doctype) { |
59 |
|
|
|
60 |
|
|
|
61 |
|
|
{ |
62 |
|
|
|
63 |
|
|
local $Error::Depth = $Error::Depth + 1; |
64 |
|
|
|
65 |
|
|
{ |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
$r-> |
70 |
|
|
append_child |
71 |
|
|
($doctype); |
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
|
78 |
|
|
;} |
79 |
|
|
|
80 |
|
|
; |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
if (defined $qualifiedName) { |
84 |
|
|
|
85 |
|
|
|
86 |
|
|
{ |
87 |
|
|
|
88 |
|
|
local $Error::Depth = $Error::Depth + 1; |
89 |
|
|
|
90 |
|
|
{ |
91 |
|
|
|
92 |
|
|
|
93 |
|
|
my |
94 |
|
|
$el = $r-> |
95 |
|
|
create_element_ns |
96 |
|
|
|
97 |
|
|
($namespaceURI, $qualifiedName); |
98 |
|
|
$r-> |
99 |
|
|
append_child |
100 |
|
|
($el); |
101 |
|
|
$r = $el-> |
102 |
|
|
owner_document |
103 |
|
|
; |
104 |
|
|
## Choose the class based on document element type |
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
|
111 |
|
|
;} |
112 |
|
|
|
113 |
|
|
; |
114 |
|
|
} elsif (defined $namespaceURI) { |
115 |
|
|
|
116 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'create_document', 'http://www.w3.org/2001/04/infoset#namespaceURI' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_NULL_QNAME_WITH_NON_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMImplementationDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'namespaceURI'; |
117 |
|
|
|
118 |
|
|
; |
119 |
|
|
} |
120 |
|
|
|
121 |
|
|
|
122 |
|
|
} |
123 |
|
|
$r} |
124 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMImplementationDocument>}->{has_feature} = {}; |
125 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMImplementationDocument>} = 0; |
126 |
wakaba |
1.15 |
package Message::DOM::IF::Document; |
127 |
|
|
our $VERSION = 20061230.0809; |
128 |
wakaba |
1.1 |
package Message::DOM::Document::ManakaiDOMDocument; |
129 |
wakaba |
1.15 |
our $VERSION = 20061230.0809; |
130 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
131 |
wakaba |
1.15 |
'Message::DOM::IF::Document', |
132 |
|
|
'Message::DOM::IF::Node'; |
133 |
wakaba |
1.1 |
sub node_type ($;$) { |
134 |
|
|
if (@_ == 1) {my ($self) = @_; |
135 |
|
|
my $r; |
136 |
wakaba |
1.7 |
$r = 9; |
137 |
wakaba |
1.1 |
$r; |
138 |
|
|
} else {my ($self) = @_; |
139 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
140 |
|
|
} |
141 |
|
|
} |
142 |
|
|
sub append_child ($$) { |
143 |
|
|
my ($self, $newChild) = @_; |
144 |
|
|
my $r; |
145 |
|
|
|
146 |
|
|
{ |
147 |
|
|
|
148 |
|
|
my |
149 |
|
|
$strictc = $self-> |
150 |
|
|
dom_config |
151 |
|
|
|
152 |
|
|
-> |
153 |
|
|
get_parameter |
154 |
|
|
|
155 |
|
|
( |
156 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
157 |
|
|
); |
158 |
|
|
my $child_od = $newChild-> |
159 |
|
|
owner_document |
160 |
|
|
|| $self; |
161 |
|
|
my $child_nt = $newChild-> |
162 |
|
|
node_type |
163 |
|
|
; |
164 |
|
|
if ($strictc and $self-> |
165 |
|
|
strict_error_checking |
166 |
|
|
) { |
167 |
|
|
|
168 |
|
|
|
169 |
|
|
{ |
170 |
|
|
|
171 |
|
|
local $Error::Depth = $Error::Depth + 1; |
172 |
|
|
|
173 |
|
|
{ |
174 |
|
|
|
175 |
|
|
|
176 |
|
|
my |
177 |
|
|
$has_el; |
178 |
|
|
my $has_dt; |
179 |
|
|
if ($child_nt == |
180 |
wakaba |
1.7 |
1 |
181 |
wakaba |
1.1 |
) { |
182 |
|
|
$has_el = |
183 |
|
|
1 |
184 |
|
|
; |
185 |
|
|
} elsif ($child_nt == |
186 |
wakaba |
1.7 |
10 |
187 |
wakaba |
1.1 |
) { |
188 |
|
|
$has_dt = |
189 |
|
|
1 |
190 |
|
|
; |
191 |
|
|
} elsif ($child_nt == |
192 |
wakaba |
1.7 |
11 |
193 |
wakaba |
1.1 |
) { |
194 |
|
|
for my $cn (@{$newChild-> |
195 |
|
|
child_nodes |
196 |
|
|
}) { |
197 |
|
|
my $cnt = $cn-> |
198 |
|
|
node_type |
199 |
|
|
; |
200 |
|
|
if ($cnt == |
201 |
wakaba |
1.7 |
1 |
202 |
wakaba |
1.1 |
) { |
203 |
|
|
if ($has_el) { |
204 |
|
|
|
205 |
|
|
|
206 |
|
|
{ |
207 |
|
|
|
208 |
|
|
local $Error::Depth = $Error::Depth - 1; |
209 |
|
|
|
210 |
|
|
{ |
211 |
|
|
|
212 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
213 |
|
|
|
214 |
|
|
|
215 |
wakaba |
1.3 |
} |
216 |
wakaba |
1.1 |
|
217 |
|
|
|
218 |
|
|
;} |
219 |
|
|
|
220 |
|
|
; |
221 |
|
|
} |
222 |
|
|
$has_el = |
223 |
|
|
1 |
224 |
|
|
; |
225 |
|
|
} |
226 |
|
|
# DocumentType node cannot be contained in DocumentFragments |
227 |
|
|
} |
228 |
|
|
} |
229 |
|
|
|
230 |
|
|
if ($has_el) { |
231 |
|
|
my $anode = $self-> |
232 |
|
|
last_child |
233 |
|
|
; |
234 |
|
|
while (defined $anode) { |
235 |
|
|
if ($anode-> |
236 |
|
|
node_type |
237 |
|
|
== |
238 |
wakaba |
1.7 |
1 |
239 |
wakaba |
1.1 |
) { |
240 |
|
|
|
241 |
|
|
|
242 |
|
|
{ |
243 |
|
|
|
244 |
|
|
local $Error::Depth = $Error::Depth - 1; |
245 |
|
|
|
246 |
|
|
{ |
247 |
|
|
|
248 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
249 |
|
|
|
250 |
|
|
|
251 |
wakaba |
1.3 |
} |
252 |
wakaba |
1.1 |
|
253 |
|
|
|
254 |
|
|
;} |
255 |
|
|
|
256 |
|
|
; |
257 |
|
|
} |
258 |
|
|
$anode = $anode-> |
259 |
|
|
previous_sibling |
260 |
|
|
; |
261 |
|
|
} |
262 |
|
|
} # has_el |
263 |
|
|
if ($has_dt) { |
264 |
|
|
my $anode = $self-> |
265 |
|
|
last_child |
266 |
|
|
; |
267 |
|
|
while (defined $anode) { |
268 |
|
|
my $ant = $anode-> |
269 |
|
|
node_type |
270 |
|
|
; |
271 |
|
|
if ($ant == |
272 |
wakaba |
1.7 |
1 |
273 |
wakaba |
1.1 |
) { |
274 |
|
|
|
275 |
|
|
|
276 |
|
|
{ |
277 |
|
|
|
278 |
|
|
local $Error::Depth = $Error::Depth - 1; |
279 |
|
|
|
280 |
|
|
{ |
281 |
|
|
|
282 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
283 |
|
|
|
284 |
|
|
|
285 |
wakaba |
1.3 |
} |
286 |
wakaba |
1.1 |
|
287 |
|
|
|
288 |
|
|
;} |
289 |
|
|
|
290 |
|
|
; |
291 |
|
|
} elsif ($ant == |
292 |
wakaba |
1.7 |
10 |
293 |
wakaba |
1.1 |
) { |
294 |
|
|
|
295 |
|
|
|
296 |
|
|
{ |
297 |
|
|
|
298 |
|
|
local $Error::Depth = $Error::Depth - 1; |
299 |
|
|
|
300 |
|
|
{ |
301 |
|
|
|
302 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
303 |
|
|
|
304 |
|
|
|
305 |
wakaba |
1.3 |
} |
306 |
wakaba |
1.1 |
|
307 |
|
|
|
308 |
|
|
;} |
309 |
|
|
|
310 |
|
|
; |
311 |
|
|
} |
312 |
|
|
$anode = $anode-> |
313 |
|
|
previous_sibling |
314 |
|
|
; |
315 |
|
|
} |
316 |
|
|
} # has_dt |
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
wakaba |
1.3 |
} |
321 |
wakaba |
1.1 |
|
322 |
|
|
|
323 |
|
|
;} |
324 |
|
|
|
325 |
|
|
; |
326 |
|
|
} |
327 |
|
|
|
328 |
|
|
|
329 |
|
|
{ |
330 |
|
|
|
331 |
|
|
|
332 |
|
|
{ |
333 |
|
|
|
334 |
|
|
local $Error::Depth = $Error::Depth + 1; |
335 |
|
|
|
336 |
|
|
{ |
337 |
|
|
|
338 |
|
|
|
339 |
|
|
my |
340 |
|
|
$strict = $self-> |
341 |
|
|
strict_error_checking |
342 |
|
|
; |
343 |
|
|
|
344 |
|
|
## -- Node Type check |
345 |
|
|
my @new_child; |
346 |
|
|
if ({ |
347 |
wakaba |
1.7 |
3 => (not $strictc), |
348 |
|
|
5 => (not $strictc), |
349 |
|
|
1 => 1, |
350 |
|
|
4 => (not $strictc), |
351 |
|
|
7 => 1, |
352 |
|
|
8 => 1, |
353 |
|
|
10 => 1, |
354 |
wakaba |
1.1 |
}->{$child_nt}) { |
355 |
|
|
push @new_child, $newChild; |
356 |
|
|
} elsif ($child_nt == |
357 |
wakaba |
1.7 |
11 |
358 |
wakaba |
1.1 |
) { |
359 |
|
|
for my $cn (@{$newChild-> |
360 |
|
|
child_nodes |
361 |
|
|
}) { |
362 |
|
|
unless ({ |
363 |
wakaba |
1.7 |
3 => (not $strictc), |
364 |
|
|
5 => (not $strictc), |
365 |
|
|
1 => 1, |
366 |
|
|
4 => (not $strictc), |
367 |
|
|
7 => 1, |
368 |
|
|
8 => 1, |
369 |
|
|
10 => 1, |
370 |
wakaba |
1.1 |
}->{$cn-> |
371 |
|
|
node_type |
372 |
|
|
}) { |
373 |
|
|
|
374 |
|
|
|
375 |
|
|
{ |
376 |
|
|
|
377 |
|
|
local $Error::Depth = $Error::Depth - 1; |
378 |
|
|
|
379 |
|
|
{ |
380 |
|
|
|
381 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
382 |
wakaba |
1.1 |
|
383 |
|
|
|
384 |
wakaba |
1.3 |
} |
385 |
wakaba |
1.1 |
|
386 |
|
|
|
387 |
|
|
;} |
388 |
|
|
|
389 |
|
|
; |
390 |
|
|
} |
391 |
|
|
push @new_child, $cn; |
392 |
|
|
} |
393 |
|
|
} else { |
394 |
|
|
|
395 |
|
|
|
396 |
|
|
{ |
397 |
|
|
|
398 |
|
|
local $Error::Depth = $Error::Depth - 1; |
399 |
|
|
|
400 |
|
|
{ |
401 |
|
|
|
402 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
403 |
wakaba |
1.1 |
|
404 |
|
|
|
405 |
wakaba |
1.3 |
} |
406 |
wakaba |
1.1 |
|
407 |
|
|
|
408 |
|
|
;} |
409 |
|
|
|
410 |
|
|
; |
411 |
|
|
} |
412 |
|
|
|
413 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
414 |
|
|
parent_node |
415 |
|
|
: |
416 |
|
|
|
417 |
|
|
undef |
418 |
|
|
; |
419 |
|
|
if ($strict) { |
420 |
|
|
## -- Wrong-document check |
421 |
|
|
unless ($self eq $child_od) { |
422 |
|
|
|
423 |
|
|
|
424 |
|
|
{ |
425 |
|
|
|
426 |
|
|
local $Error::Depth = $Error::Depth - 1; |
427 |
|
|
|
428 |
|
|
{ |
429 |
|
|
|
430 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
431 |
wakaba |
1.1 |
|
432 |
|
|
|
433 |
wakaba |
1.3 |
} |
434 |
wakaba |
1.1 |
|
435 |
|
|
|
436 |
|
|
;} |
437 |
|
|
|
438 |
|
|
; |
439 |
|
|
} |
440 |
|
|
|
441 |
|
|
## -- Read-onlyness check |
442 |
|
|
if ($self-> |
443 |
|
|
manakai_read_only |
444 |
|
|
) { |
445 |
|
|
|
446 |
|
|
|
447 |
|
|
{ |
448 |
|
|
|
449 |
|
|
local $Error::Depth = $Error::Depth - 1; |
450 |
|
|
|
451 |
|
|
{ |
452 |
|
|
|
453 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1'; |
454 |
wakaba |
1.1 |
|
455 |
|
|
|
456 |
wakaba |
1.3 |
} |
457 |
wakaba |
1.1 |
|
458 |
|
|
|
459 |
|
|
;} |
460 |
|
|
|
461 |
|
|
; |
462 |
|
|
} |
463 |
|
|
if (@new_child) { |
464 |
|
|
if ($nc_parent and |
465 |
|
|
$nc_parent-> |
466 |
|
|
manakai_read_only |
467 |
|
|
) { |
468 |
|
|
|
469 |
|
|
|
470 |
|
|
{ |
471 |
|
|
|
472 |
|
|
local $Error::Depth = $Error::Depth - 1; |
473 |
|
|
|
474 |
|
|
{ |
475 |
|
|
|
476 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1'; |
477 |
wakaba |
1.1 |
|
478 |
|
|
|
479 |
wakaba |
1.3 |
} |
480 |
wakaba |
1.1 |
|
481 |
|
|
|
482 |
|
|
;} |
483 |
|
|
|
484 |
|
|
; |
485 |
|
|
} |
486 |
|
|
} |
487 |
|
|
} |
488 |
|
|
|
489 |
|
|
## -- Insert at... |
490 |
|
|
my $index = -1; # last |
491 |
|
|
|
492 |
|
|
|
493 |
|
|
; # FOR !tc:ForAppendChild |
494 |
|
|
|
495 |
|
|
## -- Removes from parent |
496 |
|
|
if ($nc_parent) { |
497 |
|
|
if ($child_nt == |
498 |
wakaba |
1.7 |
11 |
499 |
wakaba |
1.1 |
) { |
500 |
wakaba |
1.13 |
$$newChild->{ |
501 |
|
|
'child' |
502 |
|
|
} = []; |
503 |
wakaba |
1.1 |
} else { |
504 |
wakaba |
1.13 |
my $v = $$nc_parent->{ |
505 |
|
|
'child' |
506 |
|
|
}; |
507 |
wakaba |
1.1 |
RP: for my $i (0..$#$v) { |
508 |
wakaba |
1.13 |
if ($v->[$i] eq $new_child[0]) { |
509 |
wakaba |
1.1 |
splice @$v, $i, 1, (); |
510 |
|
|
last RP; |
511 |
|
|
} |
512 |
|
|
} # RP |
513 |
|
|
} |
514 |
|
|
} |
515 |
|
|
|
516 |
|
|
## -- Rewrite the |parentNode| properties |
517 |
|
|
for my $nc (@new_child) { |
518 |
wakaba |
1.13 |
$$nc->{ |
519 |
|
|
'parent' |
520 |
|
|
} = $self; |
521 |
|
|
Scalar::Util::weaken ($$nc->{ |
522 |
|
|
'parent' |
523 |
|
|
}); |
524 |
|
|
} |
525 |
wakaba |
1.1 |
|
526 |
wakaba |
1.13 |
my $children = $$self->{ |
527 |
|
|
'child' |
528 |
wakaba |
1.1 |
}; |
529 |
|
|
|
530 |
|
|
|
531 |
|
|
|
532 |
|
|
{ |
533 |
|
|
|
534 |
|
|
|
535 |
|
|
## -- Adds to children list |
536 |
wakaba |
1.13 |
push @$children, @new_child; |
537 |
wakaba |
1.1 |
$r = $newChild; |
538 |
|
|
|
539 |
|
|
|
540 |
|
|
|
541 |
wakaba |
1.3 |
} |
542 |
wakaba |
1.1 |
|
543 |
|
|
; |
544 |
|
|
|
545 |
|
|
|
546 |
|
|
|
547 |
|
|
; |
548 |
|
|
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
; |
552 |
|
|
|
553 |
|
|
|
554 |
|
|
|
555 |
wakaba |
1.3 |
} |
556 |
wakaba |
1.1 |
|
557 |
|
|
|
558 |
|
|
;} |
559 |
|
|
|
560 |
|
|
; |
561 |
|
|
|
562 |
|
|
|
563 |
wakaba |
1.3 |
} |
564 |
wakaba |
1.1 |
|
565 |
|
|
; |
566 |
|
|
if ($child_nt == |
567 |
wakaba |
1.7 |
10 and |
568 |
wakaba |
1.1 |
|
569 |
|
|
not defined $newChild-> |
570 |
|
|
owner_document |
571 |
|
|
) { |
572 |
wakaba |
1.13 |
CORE::delete $$newChild->{ |
573 |
|
|
'impl' |
574 |
wakaba |
1.1 |
}; |
575 |
wakaba |
1.13 |
$$newChild->{ |
576 |
|
|
'od' |
577 |
|
|
} = $self; |
578 |
|
|
Scalar::Util::weaken ($$newChild->{ |
579 |
|
|
'od' |
580 |
|
|
}); |
581 |
wakaba |
1.1 |
} |
582 |
|
|
|
583 |
|
|
|
584 |
wakaba |
1.3 |
} |
585 |
wakaba |
1.1 |
$r} |
586 |
|
|
sub insert_before ($$;$) { |
587 |
|
|
my ($self, $newChild, $refChild) = @_; |
588 |
|
|
my $r; |
589 |
|
|
|
590 |
|
|
{ |
591 |
|
|
|
592 |
|
|
my |
593 |
|
|
$strictc = $self-> |
594 |
|
|
dom_config |
595 |
|
|
|
596 |
|
|
-> |
597 |
|
|
get_parameter |
598 |
|
|
|
599 |
|
|
( |
600 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
601 |
|
|
); |
602 |
|
|
my $child_od = $newChild-> |
603 |
|
|
owner_document |
604 |
|
|
|| $self; |
605 |
|
|
my $child_nt = $newChild-> |
606 |
|
|
node_type |
607 |
|
|
; |
608 |
|
|
if ($strictc and $self-> |
609 |
|
|
strict_error_checking |
610 |
|
|
) { |
611 |
|
|
|
612 |
|
|
|
613 |
|
|
{ |
614 |
|
|
|
615 |
|
|
local $Error::Depth = $Error::Depth + 1; |
616 |
|
|
|
617 |
|
|
{ |
618 |
|
|
|
619 |
|
|
|
620 |
|
|
my |
621 |
|
|
$has_el; |
622 |
|
|
my $has_dt; |
623 |
|
|
if ($child_nt == |
624 |
wakaba |
1.7 |
1 |
625 |
wakaba |
1.1 |
) { |
626 |
|
|
$has_el = |
627 |
|
|
1 |
628 |
|
|
; |
629 |
|
|
} elsif ($child_nt == |
630 |
wakaba |
1.7 |
10 |
631 |
wakaba |
1.1 |
) { |
632 |
|
|
$has_dt = |
633 |
|
|
1 |
634 |
|
|
; |
635 |
|
|
} elsif ($child_nt == |
636 |
wakaba |
1.7 |
11 |
637 |
wakaba |
1.1 |
) { |
638 |
|
|
for my $cn (@{$newChild-> |
639 |
|
|
child_nodes |
640 |
|
|
}) { |
641 |
|
|
my $cnt = $cn-> |
642 |
|
|
node_type |
643 |
|
|
; |
644 |
|
|
if ($cnt == |
645 |
wakaba |
1.7 |
1 |
646 |
wakaba |
1.1 |
) { |
647 |
|
|
if ($has_el) { |
648 |
|
|
|
649 |
|
|
|
650 |
|
|
{ |
651 |
|
|
|
652 |
|
|
local $Error::Depth = $Error::Depth - 1; |
653 |
|
|
|
654 |
|
|
{ |
655 |
|
|
|
656 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
657 |
|
|
|
658 |
|
|
|
659 |
wakaba |
1.3 |
} |
660 |
wakaba |
1.1 |
|
661 |
|
|
|
662 |
|
|
;} |
663 |
|
|
|
664 |
|
|
; |
665 |
|
|
} |
666 |
|
|
$has_el = |
667 |
|
|
1 |
668 |
|
|
; |
669 |
|
|
} |
670 |
|
|
# DocumentType node cannot be contained in DocumentFragments |
671 |
|
|
} |
672 |
|
|
} |
673 |
|
|
|
674 |
|
|
if ($has_el) { |
675 |
|
|
my $anode = $refChild ? $refChild-> |
676 |
|
|
previous_sibling |
677 |
|
|
: |
678 |
|
|
$self-> |
679 |
|
|
last_child |
680 |
|
|
; |
681 |
|
|
while (defined $anode) { |
682 |
|
|
if ($anode-> |
683 |
|
|
node_type |
684 |
|
|
== |
685 |
wakaba |
1.7 |
1 |
686 |
wakaba |
1.1 |
) { |
687 |
|
|
|
688 |
|
|
|
689 |
|
|
{ |
690 |
|
|
|
691 |
|
|
local $Error::Depth = $Error::Depth - 1; |
692 |
|
|
|
693 |
|
|
{ |
694 |
|
|
|
695 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
696 |
|
|
|
697 |
|
|
|
698 |
wakaba |
1.3 |
} |
699 |
wakaba |
1.1 |
|
700 |
|
|
|
701 |
|
|
;} |
702 |
|
|
|
703 |
|
|
; |
704 |
|
|
} |
705 |
|
|
$anode = $anode-> |
706 |
|
|
previous_sibling |
707 |
|
|
; |
708 |
|
|
} |
709 |
|
|
$anode = $refChild; |
710 |
|
|
while (defined $anode) { |
711 |
|
|
my $ant = $anode-> |
712 |
|
|
node_type |
713 |
|
|
; |
714 |
|
|
if ($ant == |
715 |
wakaba |
1.7 |
1 |
716 |
wakaba |
1.1 |
) { |
717 |
|
|
|
718 |
|
|
|
719 |
|
|
{ |
720 |
|
|
|
721 |
|
|
local $Error::Depth = $Error::Depth - 1; |
722 |
|
|
|
723 |
|
|
{ |
724 |
|
|
|
725 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
726 |
|
|
|
727 |
|
|
|
728 |
wakaba |
1.3 |
} |
729 |
wakaba |
1.1 |
|
730 |
|
|
|
731 |
|
|
;} |
732 |
|
|
|
733 |
|
|
; |
734 |
|
|
} elsif ($ant == |
735 |
wakaba |
1.7 |
10 |
736 |
wakaba |
1.1 |
) { |
737 |
|
|
|
738 |
|
|
|
739 |
|
|
{ |
740 |
|
|
|
741 |
|
|
local $Error::Depth = $Error::Depth - 1; |
742 |
|
|
|
743 |
|
|
{ |
744 |
|
|
|
745 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
746 |
|
|
|
747 |
|
|
|
748 |
wakaba |
1.3 |
} |
749 |
wakaba |
1.1 |
|
750 |
|
|
|
751 |
|
|
;} |
752 |
|
|
|
753 |
|
|
; |
754 |
|
|
} |
755 |
|
|
$anode = $anode-> |
756 |
|
|
next_sibling |
757 |
|
|
; |
758 |
|
|
} |
759 |
|
|
} # has_el |
760 |
|
|
if ($has_dt) { |
761 |
|
|
my $anode = $refChild ? $refChild-> |
762 |
|
|
previous_sibling |
763 |
|
|
: |
764 |
|
|
$self-> |
765 |
|
|
last_child |
766 |
|
|
; |
767 |
|
|
while (defined $anode) { |
768 |
|
|
my $ant = $anode-> |
769 |
|
|
node_type |
770 |
|
|
; |
771 |
|
|
if ($ant == |
772 |
wakaba |
1.7 |
1 |
773 |
wakaba |
1.1 |
) { |
774 |
|
|
|
775 |
|
|
|
776 |
|
|
{ |
777 |
|
|
|
778 |
|
|
local $Error::Depth = $Error::Depth - 1; |
779 |
|
|
|
780 |
|
|
{ |
781 |
|
|
|
782 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
783 |
|
|
|
784 |
|
|
|
785 |
wakaba |
1.3 |
} |
786 |
wakaba |
1.1 |
|
787 |
|
|
|
788 |
|
|
;} |
789 |
|
|
|
790 |
|
|
; |
791 |
|
|
} elsif ($ant == |
792 |
wakaba |
1.7 |
10 |
793 |
wakaba |
1.1 |
) { |
794 |
|
|
|
795 |
|
|
|
796 |
|
|
{ |
797 |
|
|
|
798 |
|
|
local $Error::Depth = $Error::Depth - 1; |
799 |
|
|
|
800 |
|
|
{ |
801 |
|
|
|
802 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
803 |
|
|
|
804 |
|
|
|
805 |
wakaba |
1.3 |
} |
806 |
wakaba |
1.1 |
|
807 |
|
|
|
808 |
|
|
;} |
809 |
|
|
|
810 |
|
|
; |
811 |
|
|
} |
812 |
|
|
$anode = $anode-> |
813 |
|
|
previous_sibling |
814 |
|
|
; |
815 |
|
|
} |
816 |
|
|
$anode = $refChild; |
817 |
|
|
while (defined $anode) { |
818 |
|
|
if ($anode-> |
819 |
|
|
node_type |
820 |
|
|
|
821 |
|
|
== |
822 |
wakaba |
1.7 |
10 |
823 |
wakaba |
1.1 |
) { |
824 |
|
|
|
825 |
|
|
|
826 |
|
|
{ |
827 |
|
|
|
828 |
|
|
local $Error::Depth = $Error::Depth - 1; |
829 |
|
|
|
830 |
|
|
{ |
831 |
|
|
|
832 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
833 |
|
|
|
834 |
|
|
|
835 |
wakaba |
1.3 |
} |
836 |
wakaba |
1.1 |
|
837 |
|
|
|
838 |
|
|
;} |
839 |
|
|
|
840 |
|
|
; |
841 |
|
|
} |
842 |
|
|
$anode = $anode-> |
843 |
|
|
next_sibling |
844 |
|
|
; |
845 |
|
|
} |
846 |
|
|
} # has_dt |
847 |
|
|
|
848 |
|
|
|
849 |
|
|
|
850 |
wakaba |
1.3 |
} |
851 |
wakaba |
1.1 |
|
852 |
|
|
|
853 |
|
|
;} |
854 |
|
|
|
855 |
|
|
; |
856 |
|
|
} |
857 |
|
|
|
858 |
|
|
|
859 |
|
|
{ |
860 |
|
|
|
861 |
|
|
|
862 |
|
|
{ |
863 |
|
|
|
864 |
|
|
local $Error::Depth = $Error::Depth + 1; |
865 |
|
|
|
866 |
|
|
{ |
867 |
|
|
|
868 |
|
|
|
869 |
|
|
my |
870 |
|
|
$strict = $self-> |
871 |
|
|
strict_error_checking |
872 |
|
|
; |
873 |
|
|
|
874 |
|
|
## -- Node Type check |
875 |
|
|
my @new_child; |
876 |
|
|
if ({ |
877 |
wakaba |
1.7 |
3 => (not $strictc), |
878 |
|
|
5 => (not $strictc), |
879 |
|
|
1 => 1, |
880 |
|
|
4 => (not $strictc), |
881 |
|
|
7 => 1, |
882 |
|
|
8 => 1, |
883 |
|
|
10 => 1, |
884 |
wakaba |
1.1 |
}->{$child_nt}) { |
885 |
|
|
push @new_child, $newChild; |
886 |
|
|
} elsif ($child_nt == |
887 |
wakaba |
1.7 |
11 |
888 |
wakaba |
1.1 |
) { |
889 |
|
|
for my $cn (@{$newChild-> |
890 |
|
|
child_nodes |
891 |
|
|
}) { |
892 |
|
|
unless ({ |
893 |
wakaba |
1.7 |
3 => (not $strictc), |
894 |
|
|
5 => (not $strictc), |
895 |
|
|
1 => 1, |
896 |
|
|
4 => (not $strictc), |
897 |
|
|
7 => 1, |
898 |
|
|
8 => 1, |
899 |
|
|
10 => 1, |
900 |
wakaba |
1.1 |
}->{$cn-> |
901 |
|
|
node_type |
902 |
|
|
}) { |
903 |
|
|
|
904 |
|
|
|
905 |
|
|
{ |
906 |
|
|
|
907 |
|
|
local $Error::Depth = $Error::Depth - 1; |
908 |
|
|
|
909 |
|
|
{ |
910 |
|
|
|
911 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
912 |
wakaba |
1.1 |
|
913 |
|
|
|
914 |
wakaba |
1.3 |
} |
915 |
wakaba |
1.1 |
|
916 |
|
|
|
917 |
|
|
;} |
918 |
|
|
|
919 |
|
|
; |
920 |
|
|
} |
921 |
|
|
push @new_child, $cn; |
922 |
|
|
} |
923 |
|
|
} else { |
924 |
|
|
|
925 |
|
|
|
926 |
|
|
{ |
927 |
|
|
|
928 |
|
|
local $Error::Depth = $Error::Depth - 1; |
929 |
|
|
|
930 |
|
|
{ |
931 |
|
|
|
932 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
933 |
wakaba |
1.1 |
|
934 |
|
|
|
935 |
wakaba |
1.3 |
} |
936 |
wakaba |
1.1 |
|
937 |
|
|
|
938 |
|
|
;} |
939 |
|
|
|
940 |
|
|
; |
941 |
|
|
} |
942 |
|
|
|
943 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
944 |
|
|
parent_node |
945 |
|
|
: |
946 |
|
|
|
947 |
|
|
undef |
948 |
|
|
; |
949 |
|
|
if ($strict) { |
950 |
|
|
## -- Wrong-document check |
951 |
|
|
unless ($self eq $child_od) { |
952 |
|
|
|
953 |
|
|
|
954 |
|
|
{ |
955 |
|
|
|
956 |
|
|
local $Error::Depth = $Error::Depth - 1; |
957 |
|
|
|
958 |
|
|
{ |
959 |
|
|
|
960 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
961 |
wakaba |
1.1 |
|
962 |
|
|
|
963 |
wakaba |
1.3 |
} |
964 |
wakaba |
1.1 |
|
965 |
|
|
|
966 |
|
|
;} |
967 |
|
|
|
968 |
|
|
; |
969 |
|
|
} |
970 |
|
|
|
971 |
|
|
## -- Read-onlyness check |
972 |
|
|
if ($self-> |
973 |
|
|
manakai_read_only |
974 |
|
|
) { |
975 |
|
|
|
976 |
|
|
|
977 |
|
|
{ |
978 |
|
|
|
979 |
|
|
local $Error::Depth = $Error::Depth - 1; |
980 |
|
|
|
981 |
|
|
{ |
982 |
|
|
|
983 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1'; |
984 |
wakaba |
1.1 |
|
985 |
|
|
|
986 |
wakaba |
1.3 |
} |
987 |
wakaba |
1.1 |
|
988 |
|
|
|
989 |
|
|
;} |
990 |
|
|
|
991 |
|
|
; |
992 |
|
|
} |
993 |
|
|
if (@new_child) { |
994 |
|
|
if ($nc_parent and |
995 |
|
|
$nc_parent-> |
996 |
|
|
manakai_read_only |
997 |
|
|
) { |
998 |
|
|
|
999 |
|
|
|
1000 |
|
|
{ |
1001 |
|
|
|
1002 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1003 |
|
|
|
1004 |
|
|
{ |
1005 |
|
|
|
1006 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1'; |
1007 |
wakaba |
1.1 |
|
1008 |
|
|
|
1009 |
wakaba |
1.3 |
} |
1010 |
wakaba |
1.1 |
|
1011 |
|
|
|
1012 |
|
|
;} |
1013 |
|
|
|
1014 |
|
|
; |
1015 |
|
|
} |
1016 |
|
|
} |
1017 |
|
|
} |
1018 |
|
|
|
1019 |
|
|
## -- Insert at... |
1020 |
|
|
my $index = -1; # last |
1021 |
|
|
|
1022 |
|
|
|
1023 |
|
|
{ |
1024 |
|
|
|
1025 |
|
|
|
1026 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
1027 |
|
|
if (defined $refChild) { |
1028 |
|
|
if ($refChild eq $newChild) { |
1029 |
|
|
|
1030 |
|
|
|
1031 |
|
|
{ |
1032 |
|
|
|
1033 |
|
|
|
1034 |
|
|
{ |
1035 |
|
|
|
1036 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1037 |
|
|
|
1038 |
|
|
{ |
1039 |
|
|
|
1040 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#insert-before-itself', 'rdata' => $refChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1'; |
1041 |
wakaba |
1.1 |
|
1042 |
|
|
|
1043 |
wakaba |
1.3 |
} |
1044 |
wakaba |
1.1 |
|
1045 |
|
|
|
1046 |
|
|
;} |
1047 |
|
|
|
1048 |
|
|
; |
1049 |
|
|
|
1050 |
|
|
|
1051 |
|
|
|
1052 |
wakaba |
1.3 |
} |
1053 |
wakaba |
1.1 |
|
1054 |
|
|
; |
1055 |
|
|
|
1056 |
|
|
|
1057 |
|
|
; |
1058 |
|
|
} |
1059 |
|
|
|
1060 |
|
|
my $cns = $self-> |
1061 |
|
|
child_nodes |
1062 |
|
|
; |
1063 |
|
|
my $cnsl = @$cns; |
1064 |
|
|
C: { |
1065 |
|
|
$index = 0; |
1066 |
|
|
for my $i (0..($cnsl-1)) { |
1067 |
|
|
my $cn = $cns->[$i]; |
1068 |
|
|
if ($cn eq $refChild) { |
1069 |
|
|
$index += $i; |
1070 |
|
|
last C; |
1071 |
|
|
} elsif ($cn eq $newChild) { |
1072 |
|
|
$index = -1; # offset |
1073 |
|
|
} |
1074 |
|
|
} |
1075 |
|
|
|
1076 |
|
|
|
1077 |
|
|
{ |
1078 |
|
|
|
1079 |
|
|
|
1080 |
|
|
{ |
1081 |
|
|
|
1082 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1083 |
|
|
|
1084 |
|
|
{ |
1085 |
|
|
|
1086 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'refChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $refChild; |
1087 |
wakaba |
1.1 |
|
1088 |
|
|
|
1089 |
wakaba |
1.3 |
} |
1090 |
wakaba |
1.1 |
|
1091 |
|
|
|
1092 |
|
|
;} |
1093 |
|
|
|
1094 |
|
|
; |
1095 |
|
|
|
1096 |
|
|
|
1097 |
|
|
|
1098 |
wakaba |
1.3 |
} |
1099 |
wakaba |
1.1 |
|
1100 |
|
|
; |
1101 |
|
|
|
1102 |
|
|
|
1103 |
|
|
; |
1104 |
|
|
} # C |
1105 |
|
|
} else { # |oldChild| is not defined |
1106 |
|
|
|
1107 |
|
|
|
1108 |
|
|
; |
1109 |
|
|
} |
1110 |
|
|
|
1111 |
|
|
|
1112 |
|
|
|
1113 |
wakaba |
1.3 |
} |
1114 |
wakaba |
1.1 |
|
1115 |
|
|
; # FOR !tc:ForAppendChild |
1116 |
|
|
|
1117 |
|
|
## -- Removes from parent |
1118 |
|
|
if ($nc_parent) { |
1119 |
|
|
if ($child_nt == |
1120 |
wakaba |
1.7 |
11 |
1121 |
wakaba |
1.1 |
) { |
1122 |
wakaba |
1.13 |
$$newChild->{ |
1123 |
|
|
'child' |
1124 |
|
|
} = []; |
1125 |
wakaba |
1.1 |
} else { |
1126 |
wakaba |
1.13 |
my $v = $$nc_parent->{ |
1127 |
|
|
'child' |
1128 |
|
|
}; |
1129 |
wakaba |
1.1 |
RP: for my $i (0..$#$v) { |
1130 |
wakaba |
1.13 |
if ($v->[$i] eq $new_child[0]) { |
1131 |
wakaba |
1.1 |
splice @$v, $i, 1, (); |
1132 |
|
|
last RP; |
1133 |
|
|
} |
1134 |
|
|
} # RP |
1135 |
|
|
} |
1136 |
|
|
} |
1137 |
|
|
|
1138 |
|
|
## -- Rewrite the |parentNode| properties |
1139 |
|
|
for my $nc (@new_child) { |
1140 |
wakaba |
1.13 |
$$nc->{ |
1141 |
|
|
'parent' |
1142 |
|
|
} = $self; |
1143 |
|
|
Scalar::Util::weaken ($$nc->{ |
1144 |
|
|
'parent' |
1145 |
|
|
}); |
1146 |
|
|
} |
1147 |
wakaba |
1.1 |
|
1148 |
wakaba |
1.13 |
my $children = $$self->{ |
1149 |
|
|
'child' |
1150 |
wakaba |
1.1 |
}; |
1151 |
|
|
|
1152 |
|
|
|
1153 |
|
|
|
1154 |
|
|
; |
1155 |
|
|
|
1156 |
|
|
|
1157 |
|
|
|
1158 |
|
|
{ |
1159 |
|
|
|
1160 |
|
|
|
1161 |
|
|
## -- Adds to children list |
1162 |
|
|
if ($index == -1) { |
1163 |
wakaba |
1.13 |
push @$children, @new_child; |
1164 |
wakaba |
1.1 |
} else { |
1165 |
wakaba |
1.13 |
splice @$children, $index, 0, @new_child; |
1166 |
wakaba |
1.1 |
} |
1167 |
|
|
$r = $newChild; |
1168 |
|
|
|
1169 |
|
|
|
1170 |
|
|
|
1171 |
wakaba |
1.3 |
} |
1172 |
wakaba |
1.1 |
|
1173 |
|
|
; |
1174 |
|
|
|
1175 |
|
|
|
1176 |
|
|
|
1177 |
|
|
; |
1178 |
|
|
|
1179 |
|
|
|
1180 |
|
|
|
1181 |
wakaba |
1.3 |
} |
1182 |
wakaba |
1.1 |
|
1183 |
|
|
|
1184 |
|
|
;} |
1185 |
|
|
|
1186 |
|
|
; |
1187 |
|
|
|
1188 |
|
|
|
1189 |
wakaba |
1.3 |
} |
1190 |
wakaba |
1.1 |
|
1191 |
|
|
; |
1192 |
|
|
if ($child_nt == |
1193 |
wakaba |
1.7 |
10 and |
1194 |
wakaba |
1.1 |
|
1195 |
|
|
not defined $newChild-> |
1196 |
|
|
owner_document |
1197 |
|
|
) { |
1198 |
wakaba |
1.13 |
CORE::delete $$newChild->{ |
1199 |
|
|
'impl' |
1200 |
wakaba |
1.1 |
}; |
1201 |
wakaba |
1.13 |
$$newChild->{ |
1202 |
|
|
'od' |
1203 |
|
|
} = $self; |
1204 |
|
|
Scalar::Util::weaken ($$newChild->{ |
1205 |
|
|
'od' |
1206 |
|
|
}); |
1207 |
wakaba |
1.1 |
} |
1208 |
|
|
|
1209 |
|
|
|
1210 |
wakaba |
1.3 |
} |
1211 |
wakaba |
1.1 |
$r} |
1212 |
|
|
sub replace_child ($$$) { |
1213 |
|
|
my ($self, $newChild, $oldChild) = @_; |
1214 |
|
|
my $r; |
1215 |
|
|
|
1216 |
|
|
{ |
1217 |
|
|
|
1218 |
|
|
my |
1219 |
|
|
$strictc = $self-> |
1220 |
|
|
dom_config |
1221 |
|
|
|
1222 |
|
|
-> |
1223 |
|
|
get_parameter |
1224 |
|
|
|
1225 |
|
|
( |
1226 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
1227 |
|
|
); |
1228 |
|
|
my $child_od = $newChild-> |
1229 |
|
|
owner_document |
1230 |
|
|
|| $self; |
1231 |
|
|
my $child_nt = $newChild-> |
1232 |
|
|
node_type |
1233 |
|
|
; |
1234 |
|
|
if ($strictc and $self-> |
1235 |
|
|
strict_error_checking |
1236 |
|
|
) { |
1237 |
|
|
|
1238 |
|
|
|
1239 |
|
|
{ |
1240 |
|
|
|
1241 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1242 |
|
|
|
1243 |
|
|
{ |
1244 |
|
|
|
1245 |
|
|
|
1246 |
|
|
my |
1247 |
|
|
$has_el; |
1248 |
|
|
my $has_dt; |
1249 |
|
|
if ($child_nt == |
1250 |
wakaba |
1.7 |
1 |
1251 |
wakaba |
1.1 |
) { |
1252 |
|
|
$has_el = |
1253 |
|
|
1 |
1254 |
|
|
; |
1255 |
|
|
} elsif ($child_nt == |
1256 |
wakaba |
1.7 |
10 |
1257 |
wakaba |
1.1 |
) { |
1258 |
|
|
$has_dt = |
1259 |
|
|
1 |
1260 |
|
|
; |
1261 |
|
|
} elsif ($child_nt == |
1262 |
wakaba |
1.7 |
11 |
1263 |
wakaba |
1.1 |
) { |
1264 |
|
|
for my $cn (@{$newChild-> |
1265 |
|
|
child_nodes |
1266 |
|
|
}) { |
1267 |
|
|
my $cnt = $cn-> |
1268 |
|
|
node_type |
1269 |
|
|
; |
1270 |
|
|
if ($cnt == |
1271 |
wakaba |
1.7 |
1 |
1272 |
wakaba |
1.1 |
) { |
1273 |
|
|
if ($has_el) { |
1274 |
|
|
|
1275 |
|
|
|
1276 |
|
|
{ |
1277 |
|
|
|
1278 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1279 |
|
|
|
1280 |
|
|
{ |
1281 |
|
|
|
1282 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1283 |
|
|
|
1284 |
|
|
|
1285 |
wakaba |
1.3 |
} |
1286 |
wakaba |
1.1 |
|
1287 |
|
|
|
1288 |
|
|
;} |
1289 |
|
|
|
1290 |
|
|
; |
1291 |
|
|
} |
1292 |
|
|
$has_el = |
1293 |
|
|
1 |
1294 |
|
|
; |
1295 |
|
|
} |
1296 |
|
|
# DocumentType node cannot be contained in DocumentFragments |
1297 |
|
|
} |
1298 |
|
|
} |
1299 |
|
|
|
1300 |
|
|
if ($has_el) { |
1301 |
|
|
my $anode = $oldChild-> |
1302 |
|
|
previous_sibling |
1303 |
|
|
; |
1304 |
|
|
while (defined $anode) { |
1305 |
|
|
if ($anode-> |
1306 |
|
|
node_type |
1307 |
|
|
== |
1308 |
wakaba |
1.7 |
1 |
1309 |
wakaba |
1.1 |
) { |
1310 |
|
|
|
1311 |
|
|
|
1312 |
|
|
{ |
1313 |
|
|
|
1314 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1315 |
|
|
|
1316 |
|
|
{ |
1317 |
|
|
|
1318 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1319 |
|
|
|
1320 |
|
|
|
1321 |
wakaba |
1.3 |
} |
1322 |
wakaba |
1.1 |
|
1323 |
|
|
|
1324 |
|
|
;} |
1325 |
|
|
|
1326 |
|
|
; |
1327 |
|
|
} |
1328 |
|
|
$anode = $anode-> |
1329 |
|
|
previous_sibling |
1330 |
|
|
; |
1331 |
|
|
} |
1332 |
|
|
$anode = $oldChild-> |
1333 |
|
|
next_sibling |
1334 |
|
|
; |
1335 |
|
|
while (defined $anode) { |
1336 |
|
|
my $ant = $anode-> |
1337 |
|
|
node_type |
1338 |
|
|
; |
1339 |
|
|
if ($ant == |
1340 |
wakaba |
1.7 |
1 |
1341 |
wakaba |
1.1 |
) { |
1342 |
|
|
|
1343 |
|
|
|
1344 |
|
|
{ |
1345 |
|
|
|
1346 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1347 |
|
|
|
1348 |
|
|
{ |
1349 |
|
|
|
1350 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1351 |
|
|
|
1352 |
|
|
|
1353 |
wakaba |
1.3 |
} |
1354 |
wakaba |
1.1 |
|
1355 |
|
|
|
1356 |
|
|
;} |
1357 |
|
|
|
1358 |
|
|
; |
1359 |
|
|
} elsif ($ant == |
1360 |
wakaba |
1.7 |
10 |
1361 |
wakaba |
1.1 |
) { |
1362 |
|
|
|
1363 |
|
|
|
1364 |
|
|
{ |
1365 |
|
|
|
1366 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1367 |
|
|
|
1368 |
|
|
{ |
1369 |
|
|
|
1370 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1371 |
|
|
|
1372 |
|
|
|
1373 |
wakaba |
1.3 |
} |
1374 |
wakaba |
1.1 |
|
1375 |
|
|
|
1376 |
|
|
;} |
1377 |
|
|
|
1378 |
|
|
; |
1379 |
|
|
} |
1380 |
|
|
$anode = $anode-> |
1381 |
|
|
next_sibling |
1382 |
|
|
; |
1383 |
|
|
} |
1384 |
|
|
} # has_el |
1385 |
|
|
if ($has_dt) { |
1386 |
|
|
my $anode = $oldChild-> |
1387 |
|
|
previous_sibling |
1388 |
|
|
; |
1389 |
|
|
while (defined $anode) { |
1390 |
|
|
my $ant = $anode-> |
1391 |
|
|
node_type |
1392 |
|
|
; |
1393 |
|
|
if ($ant == |
1394 |
wakaba |
1.7 |
1 |
1395 |
wakaba |
1.1 |
) { |
1396 |
|
|
|
1397 |
|
|
|
1398 |
|
|
{ |
1399 |
|
|
|
1400 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1401 |
|
|
|
1402 |
|
|
{ |
1403 |
|
|
|
1404 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1405 |
|
|
|
1406 |
|
|
|
1407 |
wakaba |
1.3 |
} |
1408 |
wakaba |
1.1 |
|
1409 |
|
|
|
1410 |
|
|
;} |
1411 |
|
|
|
1412 |
|
|
; |
1413 |
|
|
} elsif ($ant == |
1414 |
wakaba |
1.7 |
10 |
1415 |
wakaba |
1.1 |
) { |
1416 |
|
|
|
1417 |
|
|
|
1418 |
|
|
{ |
1419 |
|
|
|
1420 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1421 |
|
|
|
1422 |
|
|
{ |
1423 |
|
|
|
1424 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1425 |
|
|
|
1426 |
|
|
|
1427 |
wakaba |
1.3 |
} |
1428 |
wakaba |
1.1 |
|
1429 |
|
|
|
1430 |
|
|
;} |
1431 |
|
|
|
1432 |
|
|
; |
1433 |
|
|
} |
1434 |
|
|
$anode = $anode-> |
1435 |
|
|
previous_sibling |
1436 |
|
|
; |
1437 |
|
|
} |
1438 |
|
|
$anode = $oldChild-> |
1439 |
|
|
next_sibling |
1440 |
|
|
; |
1441 |
|
|
while (defined $anode) { |
1442 |
|
|
if ($anode-> |
1443 |
|
|
node_type |
1444 |
|
|
|
1445 |
|
|
== |
1446 |
wakaba |
1.7 |
10 |
1447 |
wakaba |
1.1 |
) { |
1448 |
|
|
|
1449 |
|
|
|
1450 |
|
|
{ |
1451 |
|
|
|
1452 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1453 |
|
|
|
1454 |
|
|
{ |
1455 |
|
|
|
1456 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1457 |
|
|
|
1458 |
|
|
|
1459 |
wakaba |
1.3 |
} |
1460 |
wakaba |
1.1 |
|
1461 |
|
|
|
1462 |
|
|
;} |
1463 |
|
|
|
1464 |
|
|
; |
1465 |
|
|
} |
1466 |
|
|
$anode = $anode-> |
1467 |
|
|
next_sibling |
1468 |
|
|
; |
1469 |
|
|
} |
1470 |
|
|
} # has_dt |
1471 |
|
|
|
1472 |
|
|
|
1473 |
|
|
|
1474 |
wakaba |
1.3 |
} |
1475 |
wakaba |
1.1 |
|
1476 |
|
|
|
1477 |
|
|
;} |
1478 |
|
|
|
1479 |
|
|
; |
1480 |
|
|
} |
1481 |
|
|
|
1482 |
|
|
|
1483 |
|
|
{ |
1484 |
|
|
|
1485 |
|
|
|
1486 |
|
|
{ |
1487 |
|
|
|
1488 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1489 |
|
|
|
1490 |
|
|
{ |
1491 |
|
|
|
1492 |
|
|
|
1493 |
|
|
my |
1494 |
|
|
$strict = $self-> |
1495 |
|
|
strict_error_checking |
1496 |
|
|
; |
1497 |
|
|
|
1498 |
|
|
## -- Node Type check |
1499 |
|
|
my @new_child; |
1500 |
|
|
if ({ |
1501 |
wakaba |
1.7 |
3 => (not $strictc), |
1502 |
|
|
5 => (not $strictc), |
1503 |
|
|
1 => 1, |
1504 |
|
|
4 => (not $strictc), |
1505 |
|
|
7 => 1, |
1506 |
|
|
8 => 1, |
1507 |
|
|
10 => 1, |
1508 |
wakaba |
1.1 |
}->{$child_nt}) { |
1509 |
|
|
push @new_child, $newChild; |
1510 |
|
|
} elsif ($child_nt == |
1511 |
wakaba |
1.7 |
11 |
1512 |
wakaba |
1.1 |
) { |
1513 |
|
|
for my $cn (@{$newChild-> |
1514 |
|
|
child_nodes |
1515 |
|
|
}) { |
1516 |
|
|
unless ({ |
1517 |
wakaba |
1.7 |
3 => (not $strictc), |
1518 |
|
|
5 => (not $strictc), |
1519 |
|
|
1 => 1, |
1520 |
|
|
4 => (not $strictc), |
1521 |
|
|
7 => 1, |
1522 |
|
|
8 => 1, |
1523 |
|
|
10 => 1, |
1524 |
wakaba |
1.1 |
}->{$cn-> |
1525 |
|
|
node_type |
1526 |
|
|
}) { |
1527 |
|
|
|
1528 |
|
|
|
1529 |
|
|
{ |
1530 |
|
|
|
1531 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1532 |
|
|
|
1533 |
|
|
{ |
1534 |
|
|
|
1535 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1536 |
wakaba |
1.1 |
|
1537 |
|
|
|
1538 |
wakaba |
1.3 |
} |
1539 |
wakaba |
1.1 |
|
1540 |
|
|
|
1541 |
|
|
;} |
1542 |
|
|
|
1543 |
|
|
; |
1544 |
|
|
} |
1545 |
|
|
push @new_child, $cn; |
1546 |
|
|
} |
1547 |
|
|
} else { |
1548 |
|
|
|
1549 |
|
|
|
1550 |
|
|
{ |
1551 |
|
|
|
1552 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1553 |
|
|
|
1554 |
|
|
{ |
1555 |
|
|
|
1556 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1557 |
wakaba |
1.1 |
|
1558 |
|
|
|
1559 |
wakaba |
1.3 |
} |
1560 |
wakaba |
1.1 |
|
1561 |
|
|
|
1562 |
|
|
;} |
1563 |
|
|
|
1564 |
|
|
; |
1565 |
|
|
} |
1566 |
|
|
|
1567 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
1568 |
|
|
parent_node |
1569 |
|
|
: |
1570 |
|
|
|
1571 |
|
|
undef |
1572 |
|
|
; |
1573 |
|
|
if ($strict) { |
1574 |
|
|
## -- Wrong-document check |
1575 |
|
|
unless ($self eq $child_od) { |
1576 |
|
|
|
1577 |
|
|
|
1578 |
|
|
{ |
1579 |
|
|
|
1580 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1581 |
|
|
|
1582 |
|
|
{ |
1583 |
|
|
|
1584 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
1585 |
wakaba |
1.1 |
|
1586 |
|
|
|
1587 |
wakaba |
1.3 |
} |
1588 |
wakaba |
1.1 |
|
1589 |
|
|
|
1590 |
|
|
;} |
1591 |
|
|
|
1592 |
|
|
; |
1593 |
|
|
} |
1594 |
|
|
|
1595 |
|
|
## -- Read-onlyness check |
1596 |
|
|
if ($self-> |
1597 |
|
|
manakai_read_only |
1598 |
|
|
) { |
1599 |
|
|
|
1600 |
|
|
|
1601 |
|
|
{ |
1602 |
|
|
|
1603 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1604 |
|
|
|
1605 |
|
|
{ |
1606 |
|
|
|
1607 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1'; |
1608 |
wakaba |
1.1 |
|
1609 |
|
|
|
1610 |
wakaba |
1.3 |
} |
1611 |
wakaba |
1.1 |
|
1612 |
|
|
|
1613 |
|
|
;} |
1614 |
|
|
|
1615 |
|
|
; |
1616 |
|
|
} |
1617 |
|
|
if (@new_child) { |
1618 |
|
|
if ($nc_parent and |
1619 |
|
|
$nc_parent-> |
1620 |
|
|
manakai_read_only |
1621 |
|
|
) { |
1622 |
|
|
|
1623 |
|
|
|
1624 |
|
|
{ |
1625 |
|
|
|
1626 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1627 |
|
|
|
1628 |
|
|
{ |
1629 |
|
|
|
1630 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1'; |
1631 |
wakaba |
1.1 |
|
1632 |
|
|
|
1633 |
wakaba |
1.3 |
} |
1634 |
wakaba |
1.1 |
|
1635 |
|
|
|
1636 |
|
|
;} |
1637 |
|
|
|
1638 |
|
|
; |
1639 |
|
|
} |
1640 |
|
|
} |
1641 |
|
|
} |
1642 |
|
|
|
1643 |
|
|
## -- Insert at... |
1644 |
|
|
my $index = -1; # last |
1645 |
|
|
|
1646 |
|
|
|
1647 |
|
|
{ |
1648 |
|
|
|
1649 |
|
|
|
1650 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
1651 |
|
|
if (defined $oldChild) { |
1652 |
|
|
if ($oldChild eq $newChild) { |
1653 |
|
|
|
1654 |
|
|
|
1655 |
|
|
; |
1656 |
|
|
|
1657 |
|
|
|
1658 |
|
|
{ |
1659 |
|
|
|
1660 |
|
|
|
1661 |
|
|
{ |
1662 |
|
|
|
1663 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1664 |
|
|
|
1665 |
|
|
{ |
1666 |
|
|
|
1667 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#replace-by-itself', 'rdata' => $oldChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1'; |
1668 |
wakaba |
1.1 |
|
1669 |
|
|
|
1670 |
wakaba |
1.3 |
} |
1671 |
wakaba |
1.1 |
|
1672 |
|
|
|
1673 |
|
|
;} |
1674 |
|
|
|
1675 |
|
|
; |
1676 |
|
|
|
1677 |
|
|
|
1678 |
|
|
|
1679 |
wakaba |
1.3 |
} |
1680 |
wakaba |
1.1 |
|
1681 |
|
|
; |
1682 |
|
|
} |
1683 |
|
|
|
1684 |
|
|
my $cns = $self-> |
1685 |
|
|
child_nodes |
1686 |
|
|
; |
1687 |
|
|
my $cnsl = @$cns; |
1688 |
|
|
C: { |
1689 |
|
|
$index = 0; |
1690 |
|
|
for my $i (0..($cnsl-1)) { |
1691 |
|
|
my $cn = $cns->[$i]; |
1692 |
|
|
if ($cn eq $oldChild) { |
1693 |
|
|
$index += $i; |
1694 |
|
|
last C; |
1695 |
|
|
} elsif ($cn eq $newChild) { |
1696 |
|
|
$index = -1; # offset |
1697 |
|
|
} |
1698 |
|
|
} |
1699 |
|
|
|
1700 |
|
|
|
1701 |
|
|
; |
1702 |
|
|
|
1703 |
|
|
|
1704 |
|
|
{ |
1705 |
|
|
|
1706 |
|
|
|
1707 |
|
|
{ |
1708 |
|
|
|
1709 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1710 |
|
|
|
1711 |
|
|
{ |
1712 |
|
|
|
1713 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
1714 |
wakaba |
1.1 |
|
1715 |
|
|
|
1716 |
wakaba |
1.3 |
} |
1717 |
wakaba |
1.1 |
|
1718 |
|
|
|
1719 |
|
|
;} |
1720 |
|
|
|
1721 |
|
|
; |
1722 |
|
|
|
1723 |
|
|
|
1724 |
|
|
|
1725 |
wakaba |
1.3 |
} |
1726 |
wakaba |
1.1 |
|
1727 |
|
|
; |
1728 |
|
|
} # C |
1729 |
|
|
} else { # |oldChild| is not defined |
1730 |
|
|
|
1731 |
|
|
|
1732 |
|
|
{ |
1733 |
|
|
|
1734 |
|
|
|
1735 |
|
|
{ |
1736 |
|
|
|
1737 |
|
|
local $Error::Depth = $Error::Depth - 1; |
1738 |
|
|
|
1739 |
|
|
{ |
1740 |
|
|
|
1741 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
1742 |
wakaba |
1.1 |
|
1743 |
|
|
|
1744 |
wakaba |
1.3 |
} |
1745 |
wakaba |
1.1 |
|
1746 |
|
|
|
1747 |
|
|
;} |
1748 |
|
|
|
1749 |
|
|
; |
1750 |
|
|
|
1751 |
|
|
|
1752 |
|
|
|
1753 |
wakaba |
1.3 |
} |
1754 |
wakaba |
1.1 |
|
1755 |
|
|
; |
1756 |
|
|
} |
1757 |
|
|
|
1758 |
|
|
|
1759 |
|
|
|
1760 |
wakaba |
1.3 |
} |
1761 |
wakaba |
1.1 |
|
1762 |
|
|
; # FOR !tc:ForAppendChild |
1763 |
|
|
|
1764 |
|
|
## -- Removes from parent |
1765 |
|
|
if ($nc_parent) { |
1766 |
|
|
if ($child_nt == |
1767 |
wakaba |
1.7 |
11 |
1768 |
wakaba |
1.1 |
) { |
1769 |
wakaba |
1.13 |
$$newChild->{ |
1770 |
|
|
'child' |
1771 |
|
|
} = []; |
1772 |
wakaba |
1.1 |
} else { |
1773 |
wakaba |
1.13 |
my $v = $$nc_parent->{ |
1774 |
|
|
'child' |
1775 |
|
|
}; |
1776 |
wakaba |
1.1 |
RP: for my $i (0..$#$v) { |
1777 |
wakaba |
1.13 |
if ($v->[$i] eq $new_child[0]) { |
1778 |
wakaba |
1.1 |
splice @$v, $i, 1, (); |
1779 |
|
|
last RP; |
1780 |
|
|
} |
1781 |
|
|
} # RP |
1782 |
|
|
} |
1783 |
|
|
} |
1784 |
|
|
|
1785 |
|
|
## -- Rewrite the |parentNode| properties |
1786 |
|
|
for my $nc (@new_child) { |
1787 |
wakaba |
1.13 |
$$nc->{ |
1788 |
|
|
'parent' |
1789 |
|
|
} = $self; |
1790 |
|
|
Scalar::Util::weaken ($$nc->{ |
1791 |
|
|
'parent' |
1792 |
|
|
}); |
1793 |
|
|
} |
1794 |
wakaba |
1.1 |
|
1795 |
wakaba |
1.13 |
my $children = $$self->{ |
1796 |
|
|
'child' |
1797 |
|
|
}; |
1798 |
wakaba |
1.1 |
|
1799 |
wakaba |
1.13 |
|
1800 |
wakaba |
1.1 |
|
1801 |
wakaba |
1.13 |
; |
1802 |
wakaba |
1.1 |
|
1803 |
wakaba |
1.13 |
|
1804 |
wakaba |
1.1 |
|
1805 |
|
|
; |
1806 |
|
|
|
1807 |
|
|
|
1808 |
|
|
|
1809 |
|
|
{ |
1810 |
|
|
|
1811 |
|
|
|
1812 |
wakaba |
1.13 |
## -- Replaces the node |
1813 |
|
|
splice @$children, $index, 1, @new_child; |
1814 |
|
|
CORE::delete $$oldChild->{ |
1815 |
|
|
'parent' |
1816 |
|
|
}; |
1817 |
|
|
$r = $oldChild; |
1818 |
|
|
|
1819 |
wakaba |
1.1 |
|
1820 |
|
|
|
1821 |
wakaba |
1.3 |
} |
1822 |
wakaba |
1.1 |
|
1823 |
|
|
; |
1824 |
|
|
|
1825 |
|
|
|
1826 |
|
|
|
1827 |
wakaba |
1.13 |
} |
1828 |
|
|
|
1829 |
|
|
|
1830 |
|
|
;} |
1831 |
wakaba |
1.1 |
|
1832 |
|
|
; |
1833 |
|
|
|
1834 |
|
|
|
1835 |
wakaba |
1.13 |
} |
1836 |
wakaba |
1.1 |
|
1837 |
wakaba |
1.13 |
; |
1838 |
wakaba |
1.1 |
if ($child_nt == |
1839 |
wakaba |
1.7 |
10 and |
1840 |
wakaba |
1.1 |
|
1841 |
|
|
not defined $newChild-> |
1842 |
|
|
owner_document |
1843 |
|
|
) { |
1844 |
wakaba |
1.13 |
CORE::delete $$newChild->{ |
1845 |
|
|
'impl' |
1846 |
wakaba |
1.1 |
}; |
1847 |
wakaba |
1.13 |
$$newChild->{ |
1848 |
|
|
'od' |
1849 |
|
|
} = $self; |
1850 |
|
|
Scalar::Util::weaken ($$newChild->{ |
1851 |
|
|
'od' |
1852 |
|
|
}); |
1853 |
wakaba |
1.1 |
} |
1854 |
|
|
|
1855 |
|
|
|
1856 |
wakaba |
1.3 |
} |
1857 |
wakaba |
1.1 |
$r} |
1858 |
|
|
sub manakai_append_text ($$) { |
1859 |
|
|
my ($self, $string) = @_; |
1860 |
|
|
my $r; |
1861 |
|
|
|
1862 |
|
|
{ |
1863 |
|
|
|
1864 |
|
|
|
1865 |
|
|
{ |
1866 |
|
|
|
1867 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1868 |
|
|
|
1869 |
|
|
{ |
1870 |
|
|
|
1871 |
|
|
|
1872 |
|
|
unless |
1873 |
|
|
($self-> |
1874 |
|
|
dom_config |
1875 |
|
|
|
1876 |
|
|
-> |
1877 |
|
|
get_parameter |
1878 |
|
|
|
1879 |
|
|
( |
1880 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
1881 |
|
|
)) { |
1882 |
|
|
my $lc = $self-> |
1883 |
|
|
last_child |
1884 |
|
|
; |
1885 |
|
|
if (defined $lc and |
1886 |
|
|
$lc-> |
1887 |
|
|
node_type |
1888 |
|
|
== |
1889 |
wakaba |
1.7 |
3 |
1890 |
wakaba |
1.1 |
) { |
1891 |
|
|
$lc-> |
1892 |
|
|
manakai_append_text |
1893 |
|
|
|
1894 |
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
1895 |
|
|
} else { |
1896 |
|
|
my $text = $self-> |
1897 |
|
|
create_text_node |
1898 |
|
|
|
1899 |
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
1900 |
|
|
$self-> |
1901 |
|
|
append_child |
1902 |
|
|
($text); |
1903 |
|
|
} |
1904 |
|
|
} |
1905 |
|
|
$r = $self; |
1906 |
|
|
|
1907 |
|
|
|
1908 |
|
|
|
1909 |
wakaba |
1.3 |
} |
1910 |
wakaba |
1.1 |
|
1911 |
|
|
|
1912 |
|
|
;} |
1913 |
|
|
|
1914 |
|
|
; |
1915 |
|
|
|
1916 |
|
|
|
1917 |
wakaba |
1.3 |
} |
1918 |
wakaba |
1.1 |
$r} |
1919 |
|
|
sub remove_child ($$) { |
1920 |
|
|
my ($self, $oldChild) = @_; |
1921 |
|
|
my $r; |
1922 |
|
|
|
1923 |
|
|
{ |
1924 |
|
|
|
1925 |
|
|
if |
1926 |
|
|
($self-> |
1927 |
|
|
strict_error_checking and |
1928 |
|
|
|
1929 |
|
|
$self-> |
1930 |
|
|
manakai_read_only |
1931 |
|
|
) { |
1932 |
|
|
|
1933 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'remove_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
1934 |
|
|
|
1935 |
|
|
; |
1936 |
|
|
} |
1937 |
|
|
|
1938 |
|
|
|
1939 |
|
|
{ |
1940 |
|
|
|
1941 |
|
|
F: |
1942 |
|
|
{ |
1943 |
|
|
my $i = -1; |
1944 |
wakaba |
1.13 |
my $v = $$self->{ |
1945 |
|
|
'child' |
1946 |
|
|
}; |
1947 |
|
|
for my $cld (@$v) { |
1948 |
wakaba |
1.1 |
$i++; |
1949 |
|
|
if ($cld eq $oldChild) { |
1950 |
|
|
splice @$v, $i, 1, (); |
1951 |
wakaba |
1.13 |
CORE::delete $$oldChild->{ |
1952 |
|
|
'parent' |
1953 |
|
|
}; |
1954 |
wakaba |
1.1 |
$r = $oldChild; |
1955 |
|
|
last F; |
1956 |
|
|
} |
1957 |
|
|
} |
1958 |
|
|
|
1959 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/removeChildImpl', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
1960 |
wakaba |
1.1 |
|
1961 |
|
|
; |
1962 |
|
|
} # F |
1963 |
|
|
|
1964 |
|
|
|
1965 |
wakaba |
1.3 |
} |
1966 |
wakaba |
1.1 |
|
1967 |
|
|
; |
1968 |
|
|
|
1969 |
|
|
|
1970 |
wakaba |
1.3 |
} |
1971 |
wakaba |
1.1 |
$r} |
1972 |
|
|
sub node_name ($;$) { |
1973 |
|
|
if (@_ == 1) {my ($self) = @_; |
1974 |
wakaba |
1.12 |
my $r = ''; |
1975 |
wakaba |
1.1 |
$r = '#document'; |
1976 |
|
|
$r; |
1977 |
|
|
} else {my ($self) = @_; |
1978 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
1979 |
|
|
} |
1980 |
|
|
} |
1981 |
|
|
sub text_content ($;$) { |
1982 |
|
|
if (@_ == 1) {my ($self) = @_; |
1983 |
wakaba |
1.12 |
my $r = ''; |
1984 |
wakaba |
1.1 |
|
1985 |
|
|
{ |
1986 |
|
|
|
1987 |
|
|
|
1988 |
|
|
{ |
1989 |
|
|
|
1990 |
|
|
local $Error::Depth = $Error::Depth + 1; |
1991 |
|
|
|
1992 |
|
|
{ |
1993 |
|
|
|
1994 |
|
|
|
1995 |
|
|
if |
1996 |
|
|
($self-> |
1997 |
|
|
dom_config |
1998 |
|
|
|
1999 |
|
|
-> |
2000 |
|
|
get_parameter |
2001 |
|
|
|
2002 |
|
|
( |
2003 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
2004 |
|
|
)) { |
2005 |
|
|
$r = |
2006 |
|
|
undef |
2007 |
|
|
; |
2008 |
|
|
} else { |
2009 |
|
|
$r = ''; |
2010 |
|
|
my @target = @{$self-> |
2011 |
|
|
child_nodes |
2012 |
|
|
}; |
2013 |
|
|
C: for my $node (@target) { |
2014 |
|
|
my $nt = $node-> |
2015 |
|
|
node_type |
2016 |
|
|
; |
2017 |
|
|
if ($nt == |
2018 |
wakaba |
1.7 |
3 or |
2019 |
wakaba |
1.1 |
|
2020 |
|
|
$nt == |
2021 |
wakaba |
1.7 |
4 |
2022 |
wakaba |
1.1 |
) { |
2023 |
|
|
$r .= $node-> |
2024 |
|
|
data |
2025 |
|
|
unless |
2026 |
|
|
$node-> |
2027 |
|
|
is_element_content_whitespace |
2028 |
|
|
; |
2029 |
|
|
} elsif ($nt == |
2030 |
wakaba |
1.7 |
1 or |
2031 |
wakaba |
1.1 |
|
2032 |
|
|
$nt == |
2033 |
wakaba |
1.7 |
5 |
2034 |
wakaba |
1.1 |
) { |
2035 |
|
|
unshift @target, @{$node-> |
2036 |
|
|
child_nodes |
2037 |
|
|
}; |
2038 |
|
|
} |
2039 |
|
|
} |
2040 |
|
|
} |
2041 |
|
|
|
2042 |
|
|
|
2043 |
|
|
|
2044 |
wakaba |
1.3 |
} |
2045 |
wakaba |
1.1 |
|
2046 |
|
|
|
2047 |
|
|
;} |
2048 |
|
|
|
2049 |
|
|
; |
2050 |
|
|
|
2051 |
|
|
|
2052 |
wakaba |
1.3 |
} |
2053 |
wakaba |
1.1 |
$r; |
2054 |
|
|
} else {my ($self, $given) = @_; |
2055 |
|
|
|
2056 |
|
|
{ |
2057 |
|
|
|
2058 |
|
|
if |
2059 |
|
|
($self-> |
2060 |
|
|
dom_config |
2061 |
|
|
|
2062 |
|
|
-> |
2063 |
|
|
get_parameter |
2064 |
|
|
|
2065 |
|
|
( |
2066 |
|
|
'http://suika.fam.cx/www/2006/dom-config/strict-document-children' |
2067 |
|
|
)) { |
2068 |
|
|
|
2069 |
|
|
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#setting-node-value-no-effect', 'rdata' => $self, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'text_content'; |
2070 |
|
|
|
2071 |
|
|
; |
2072 |
|
|
} else { |
2073 |
|
|
|
2074 |
|
|
|
2075 |
|
|
{ |
2076 |
|
|
|
2077 |
|
|
|
2078 |
|
|
{ |
2079 |
|
|
|
2080 |
|
|
if |
2081 |
|
|
($self-> |
2082 |
|
|
manakai_read_only |
2083 |
|
|
) { |
2084 |
|
|
|
2085 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
2086 |
wakaba |
1.1 |
|
2087 |
|
|
; |
2088 |
|
|
} |
2089 |
|
|
|
2090 |
|
|
|
2091 |
wakaba |
1.3 |
} |
2092 |
wakaba |
1.1 |
|
2093 |
|
|
; |
2094 |
wakaba |
1.10 |
|
2095 |
wakaba |
1.13 |
for my $__old_child (@{${$self}->{ |
2096 |
|
|
'child' |
2097 |
|
|
}}) { |
2098 |
|
|
CORE::delete $$__old_child->{ |
2099 |
|
|
'parent' |
2100 |
wakaba |
1.10 |
}; |
2101 |
|
|
} |
2102 |
wakaba |
1.1 |
|
2103 |
wakaba |
1.10 |
my @__new_children; |
2104 |
|
|
if (defined $given and length $given) { |
2105 |
|
|
my $__text = $self-> |
2106 |
|
|
create_text_node |
2107 |
|
|
($given); |
2108 |
wakaba |
1.13 |
push @__new_children, $__text; |
2109 |
|
|
$$__text->{ |
2110 |
|
|
'parent' |
2111 |
|
|
} = $self; |
2112 |
|
|
Scalar::Util::weaken ($$__text->{ |
2113 |
|
|
'parent' |
2114 |
|
|
}); |
2115 |
wakaba |
1.10 |
} |
2116 |
wakaba |
1.1 |
|
2117 |
wakaba |
1.13 |
${$self}->{ |
2118 |
|
|
'child' |
2119 |
|
|
} = \@__new_children; |
2120 |
wakaba |
1.1 |
|
2121 |
|
|
|
2122 |
wakaba |
1.3 |
} |
2123 |
wakaba |
1.1 |
|
2124 |
|
|
; |
2125 |
|
|
} |
2126 |
|
|
|
2127 |
|
|
|
2128 |
wakaba |
1.3 |
} |
2129 |
wakaba |
1.1 |
} |
2130 |
wakaba |
1.10 |
} |
2131 |
|
|
sub get_feature ($$$) { |
2132 |
|
|
my ($self, $feature, $version) = @_; |
2133 |
wakaba |
1.1 |
|
2134 |
wakaba |
1.10 |
{ |
2135 |
wakaba |
1.1 |
|
2136 |
|
|
|
2137 |
wakaba |
1.10 |
$feature = lc $feature; |
2138 |
wakaba |
1.1 |
|
2139 |
|
|
|
2140 |
wakaba |
1.10 |
} |
2141 |
wakaba |
1.1 |
|
2142 |
wakaba |
1.10 |
{ |
2143 |
wakaba |
1.1 |
|
2144 |
|
|
|
2145 |
wakaba |
1.10 |
$version = '' unless defined $version; |
2146 |
wakaba |
1.1 |
|
2147 |
|
|
|
2148 |
wakaba |
1.3 |
} |
2149 |
wakaba |
1.10 |
my $r; |
2150 |
|
|
|
2151 |
|
|
{ |
2152 |
wakaba |
1.1 |
|
2153 |
|
|
|
2154 |
wakaba |
1.10 |
$feature =~ s/^\+//; |
2155 |
wakaba |
1.1 |
|
2156 |
|
|
|
2157 |
|
|
{ |
2158 |
|
|
|
2159 |
wakaba |
1.10 |
if |
2160 |
|
|
($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { |
2161 |
|
|
$r = $self; |
2162 |
|
|
} |
2163 |
wakaba |
1.1 |
|
2164 |
|
|
|
2165 |
wakaba |
1.3 |
} |
2166 |
wakaba |
1.1 |
|
2167 |
|
|
; |
2168 |
wakaba |
1.10 |
unless (defined $r) { |
2169 |
|
|
|
2170 |
wakaba |
1.1 |
|
2171 |
|
|
{ |
2172 |
|
|
|
2173 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2174 |
|
|
|
2175 |
|
|
{ |
2176 |
|
|
|
2177 |
|
|
|
2178 |
|
|
|
2179 |
wakaba |
1.10 |
$r = $self->SUPER::get_feature ($feature, $version); |
2180 |
|
|
|
2181 |
wakaba |
1.1 |
|
2182 |
|
|
|
2183 |
wakaba |
1.3 |
} |
2184 |
wakaba |
1.1 |
|
2185 |
|
|
|
2186 |
|
|
;} |
2187 |
|
|
|
2188 |
|
|
; |
2189 |
wakaba |
1.10 |
} |
2190 |
wakaba |
1.1 |
|
2191 |
|
|
|
2192 |
wakaba |
1.3 |
} |
2193 |
wakaba |
1.1 |
$r} |
2194 |
wakaba |
1.10 |
sub base_uri ($;$) { |
2195 |
|
|
if (@_ == 1) {my ($self) = @_; |
2196 |
wakaba |
1.12 |
my $r = ''; |
2197 |
wakaba |
1.10 |
|
2198 |
|
|
{ |
2199 |
|
|
|
2200 |
wakaba |
1.1 |
|
2201 |
wakaba |
1.13 |
$r = $$self->{ |
2202 |
|
|
'buri' |
2203 |
|
|
}; |
2204 |
wakaba |
1.10 |
unless (defined $r) { |
2205 |
wakaba |
1.13 |
$r = $$self->{ |
2206 |
|
|
'duri' |
2207 |
|
|
}; |
2208 |
wakaba |
1.1 |
} |
2209 |
|
|
|
2210 |
|
|
|
2211 |
wakaba |
1.3 |
} |
2212 |
wakaba |
1.10 |
$r; |
2213 |
|
|
} else {my ($self) = @_; |
2214 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; |
2215 |
|
|
} |
2216 |
|
|
} |
2217 |
|
|
sub create_document_fragment ($) { |
2218 |
|
|
my ($self) = @_; |
2219 |
|
|
my $r; |
2220 |
wakaba |
1.1 |
|
2221 |
wakaba |
1.10 |
{ |
2222 |
wakaba |
1.1 |
|
2223 |
|
|
|
2224 |
wakaba |
1.14 |
$r = bless \{ |
2225 |
wakaba |
1.1 |
|
2226 |
wakaba |
1.13 |
'od' |
2227 |
|
|
=> $self, |
2228 |
wakaba |
1.1 |
|
2229 |
wakaba |
1.13 |
'child' |
2230 |
|
|
=> [], |
2231 |
wakaba |
1.14 |
}, |
2232 |
wakaba |
1.13 |
'Message::DOM::Document::ManakaiDOMDocumentFragment' |
2233 |
|
|
; |
2234 |
|
|
Scalar::Util::weaken ($$r->{ |
2235 |
|
|
'od' |
2236 |
|
|
}); |
2237 |
wakaba |
1.1 |
|
2238 |
|
|
|
2239 |
wakaba |
1.3 |
} |
2240 |
wakaba |
1.1 |
$r} |
2241 |
|
|
sub strict_error_checking ($;$) { |
2242 |
|
|
if (@_ == 1) {my ($self) = @_; |
2243 |
|
|
my $r = 0; |
2244 |
|
|
|
2245 |
|
|
{ |
2246 |
|
|
|
2247 |
|
|
|
2248 |
wakaba |
1.13 |
$r = $$self->{ |
2249 |
|
|
'chk' |
2250 |
|
|
}; |
2251 |
wakaba |
1.1 |
|
2252 |
|
|
|
2253 |
wakaba |
1.3 |
} |
2254 |
wakaba |
1.1 |
$r; |
2255 |
|
|
} else {my ($self, $given) = @_; |
2256 |
|
|
|
2257 |
|
|
{ |
2258 |
|
|
|
2259 |
|
|
|
2260 |
wakaba |
1.13 |
$$self->{ |
2261 |
|
|
'chk' |
2262 |
|
|
} = $given; |
2263 |
wakaba |
1.1 |
|
2264 |
|
|
|
2265 |
wakaba |
1.3 |
} |
2266 |
wakaba |
1.1 |
} |
2267 |
|
|
} |
2268 |
|
|
sub dom_config ($;$) { |
2269 |
|
|
if (@_ == 1) {my ($self) = @_; |
2270 |
|
|
my $r; |
2271 |
|
|
|
2272 |
|
|
{ |
2273 |
|
|
|
2274 |
|
|
|
2275 |
|
|
{ |
2276 |
|
|
|
2277 |
|
|
|
2278 |
wakaba |
1.15 |
$r = bless [$self, $$self, 'Message::DOM::IF::Document'], |
2279 |
wakaba |
1.1 |
|
2280 |
|
|
'Message::DOM::DOMCore::ManakaiDOMConfiguration' |
2281 |
|
|
; |
2282 |
|
|
|
2283 |
|
|
|
2284 |
wakaba |
1.3 |
} |
2285 |
wakaba |
1.1 |
|
2286 |
|
|
; |
2287 |
|
|
|
2288 |
|
|
|
2289 |
wakaba |
1.3 |
} |
2290 |
wakaba |
1.1 |
$r; |
2291 |
|
|
} else {my ($self) = @_; |
2292 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'dom_config'; |
2293 |
|
|
} |
2294 |
|
|
} |
2295 |
|
|
sub document_element ($;$) { |
2296 |
|
|
if (@_ == 1) {my ($self) = @_; |
2297 |
|
|
my $r; |
2298 |
|
|
|
2299 |
|
|
{ |
2300 |
|
|
|
2301 |
|
|
|
2302 |
|
|
{ |
2303 |
|
|
|
2304 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2305 |
|
|
|
2306 |
|
|
{ |
2307 |
|
|
|
2308 |
|
|
|
2309 |
|
|
F: |
2310 |
|
|
for my $child (@{$self-> |
2311 |
|
|
child_nodes |
2312 |
|
|
}) { |
2313 |
|
|
if ($child-> |
2314 |
|
|
node_type |
2315 |
|
|
== |
2316 |
wakaba |
1.7 |
1 |
2317 |
wakaba |
1.1 |
) { |
2318 |
|
|
$r = $child; |
2319 |
|
|
last F; |
2320 |
|
|
} |
2321 |
|
|
} # F |
2322 |
|
|
|
2323 |
|
|
|
2324 |
|
|
|
2325 |
wakaba |
1.3 |
} |
2326 |
wakaba |
1.1 |
|
2327 |
|
|
|
2328 |
|
|
;} |
2329 |
|
|
|
2330 |
|
|
; |
2331 |
|
|
|
2332 |
|
|
|
2333 |
wakaba |
1.3 |
} |
2334 |
wakaba |
1.1 |
$r; |
2335 |
|
|
} else {my ($self) = @_; |
2336 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'document_element'; |
2337 |
|
|
} |
2338 |
|
|
} |
2339 |
|
|
sub implementation ($;$) { |
2340 |
|
|
if (@_ == 1) {my ($self) = @_; |
2341 |
|
|
my $r; |
2342 |
|
|
|
2343 |
|
|
{ |
2344 |
|
|
|
2345 |
|
|
|
2346 |
wakaba |
1.13 |
$r = $$self->{ |
2347 |
|
|
'impl' |
2348 |
|
|
}; |
2349 |
wakaba |
1.1 |
|
2350 |
|
|
|
2351 |
wakaba |
1.3 |
} |
2352 |
wakaba |
1.1 |
$r; |
2353 |
|
|
} else {my ($self) = @_; |
2354 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'implementation'; |
2355 |
|
|
} |
2356 |
|
|
} |
2357 |
|
|
sub xml_version ($;$) { |
2358 |
|
|
if (@_ == 1) {my ($self) = @_; |
2359 |
wakaba |
1.12 |
my $r = ''; |
2360 |
wakaba |
1.1 |
|
2361 |
|
|
{ |
2362 |
|
|
|
2363 |
|
|
|
2364 |
wakaba |
1.13 |
$r = $$self->{ |
2365 |
|
|
'http://www.w3.org/2001/04/infoset#version' |
2366 |
|
|
}; |
2367 |
wakaba |
1.1 |
|
2368 |
|
|
|
2369 |
wakaba |
1.3 |
} |
2370 |
wakaba |
1.1 |
$r; |
2371 |
|
|
} else {my ($self, $given) = @_; |
2372 |
|
|
|
2373 |
|
|
{ |
2374 |
|
|
|
2375 |
|
|
|
2376 |
|
|
{ |
2377 |
|
|
|
2378 |
|
|
if |
2379 |
|
|
($self-> |
2380 |
|
|
manakai_read_only |
2381 |
|
|
) { |
2382 |
|
|
|
2383 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
2384 |
wakaba |
1.1 |
|
2385 |
|
|
; |
2386 |
|
|
} |
2387 |
|
|
|
2388 |
|
|
|
2389 |
wakaba |
1.3 |
} |
2390 |
wakaba |
1.1 |
|
2391 |
|
|
; |
2392 |
|
|
if (defined $given and |
2393 |
|
|
($given eq '1.0' or $given eq '1.1' or |
2394 |
|
|
not $self-> |
2395 |
|
|
strict_error_checking |
2396 |
|
|
)) { |
2397 |
wakaba |
1.13 |
$$self->{ |
2398 |
|
|
'http://www.w3.org/2001/04/infoset#version' |
2399 |
|
|
} = $given; |
2400 |
wakaba |
1.1 |
} else { |
2401 |
|
|
|
2402 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_NOSUPPORT_XMLVER', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'xml_version', 'http://www.w3.org/2001/04/infoset#version' => $given; |
2403 |
|
|
|
2404 |
|
|
; |
2405 |
|
|
} |
2406 |
|
|
|
2407 |
|
|
|
2408 |
wakaba |
1.3 |
} |
2409 |
wakaba |
1.1 |
} |
2410 |
|
|
} |
2411 |
|
|
sub doctype ($;$) { |
2412 |
|
|
if (@_ == 1) {my ($self) = @_; |
2413 |
|
|
my $r; |
2414 |
|
|
|
2415 |
|
|
{ |
2416 |
|
|
|
2417 |
|
|
|
2418 |
|
|
{ |
2419 |
|
|
|
2420 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2421 |
|
|
|
2422 |
|
|
{ |
2423 |
|
|
|
2424 |
|
|
|
2425 |
|
|
F: |
2426 |
|
|
for my $child (@{$self-> |
2427 |
|
|
child_nodes |
2428 |
|
|
}) { |
2429 |
|
|
my $nt = $child-> |
2430 |
|
|
node_type |
2431 |
|
|
; |
2432 |
|
|
if ($nt == |
2433 |
wakaba |
1.7 |
10 |
2434 |
wakaba |
1.1 |
) { |
2435 |
|
|
$r = $child; |
2436 |
|
|
last F; |
2437 |
|
|
} elsif ($nt == |
2438 |
wakaba |
1.7 |
1 |
2439 |
wakaba |
1.1 |
) { # document element |
2440 |
|
|
last F; |
2441 |
|
|
} |
2442 |
|
|
} # F |
2443 |
|
|
|
2444 |
|
|
|
2445 |
|
|
|
2446 |
wakaba |
1.3 |
} |
2447 |
wakaba |
1.1 |
|
2448 |
|
|
|
2449 |
|
|
;} |
2450 |
|
|
|
2451 |
|
|
; |
2452 |
|
|
|
2453 |
|
|
|
2454 |
wakaba |
1.3 |
} |
2455 |
wakaba |
1.1 |
$r; |
2456 |
|
|
} else {my ($self) = @_; |
2457 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'doctype'; |
2458 |
|
|
} |
2459 |
|
|
} |
2460 |
|
|
sub document_uri ($;$) { |
2461 |
|
|
if (@_ == 1) {my ($self) = @_; |
2462 |
|
|
my $r = ''; |
2463 |
|
|
|
2464 |
|
|
{ |
2465 |
|
|
|
2466 |
|
|
|
2467 |
wakaba |
1.13 |
$r = $$self->{ |
2468 |
|
|
'duri' |
2469 |
|
|
}; |
2470 |
wakaba |
1.1 |
|
2471 |
|
|
|
2472 |
wakaba |
1.3 |
} |
2473 |
wakaba |
1.1 |
$r; |
2474 |
|
|
} else {my ($self, $given) = @_; |
2475 |
|
|
|
2476 |
|
|
{ |
2477 |
|
|
|
2478 |
|
|
|
2479 |
|
|
{ |
2480 |
|
|
|
2481 |
|
|
if |
2482 |
|
|
($self-> |
2483 |
|
|
manakai_read_only |
2484 |
|
|
) { |
2485 |
|
|
|
2486 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
2487 |
wakaba |
1.1 |
|
2488 |
|
|
; |
2489 |
|
|
} |
2490 |
|
|
|
2491 |
|
|
|
2492 |
wakaba |
1.3 |
} |
2493 |
wakaba |
1.1 |
|
2494 |
|
|
; |
2495 |
wakaba |
1.13 |
$$self->{ |
2496 |
|
|
'duri' |
2497 |
|
|
} = $given; |
2498 |
wakaba |
1.1 |
|
2499 |
|
|
|
2500 |
wakaba |
1.3 |
} |
2501 |
wakaba |
1.1 |
} |
2502 |
|
|
} |
2503 |
|
|
sub input_encoding ($;$) { |
2504 |
|
|
if (@_ == 1) {my ($self) = @_; |
2505 |
wakaba |
1.12 |
my $r = ''; |
2506 |
wakaba |
1.1 |
|
2507 |
|
|
{ |
2508 |
|
|
|
2509 |
|
|
|
2510 |
wakaba |
1.13 |
$r = $$self->{ |
2511 |
|
|
'ces' |
2512 |
|
|
}; |
2513 |
wakaba |
1.1 |
|
2514 |
|
|
|
2515 |
wakaba |
1.3 |
} |
2516 |
wakaba |
1.1 |
$r; |
2517 |
|
|
} else {my ($self, $given) = @_; |
2518 |
|
|
|
2519 |
|
|
{ |
2520 |
|
|
|
2521 |
|
|
|
2522 |
|
|
{ |
2523 |
|
|
|
2524 |
|
|
if |
2525 |
|
|
($self-> |
2526 |
|
|
manakai_read_only |
2527 |
|
|
) { |
2528 |
|
|
|
2529 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
2530 |
wakaba |
1.1 |
|
2531 |
|
|
; |
2532 |
|
|
} |
2533 |
|
|
|
2534 |
|
|
|
2535 |
wakaba |
1.3 |
} |
2536 |
wakaba |
1.1 |
|
2537 |
|
|
; |
2538 |
wakaba |
1.13 |
$$self->{ |
2539 |
|
|
'ces' |
2540 |
|
|
} = $given; |
2541 |
wakaba |
1.1 |
|
2542 |
|
|
|
2543 |
wakaba |
1.3 |
} |
2544 |
wakaba |
1.1 |
} |
2545 |
|
|
} |
2546 |
|
|
sub xml_encoding ($;$) { |
2547 |
|
|
if (@_ == 1) {my ($self) = @_; |
2548 |
wakaba |
1.12 |
my $r = ''; |
2549 |
wakaba |
1.1 |
|
2550 |
|
|
{ |
2551 |
|
|
|
2552 |
|
|
|
2553 |
wakaba |
1.13 |
$r = $$self->{ |
2554 |
|
|
'xcs' |
2555 |
|
|
}; |
2556 |
wakaba |
1.1 |
|
2557 |
|
|
|
2558 |
wakaba |
1.3 |
} |
2559 |
wakaba |
1.1 |
$r; |
2560 |
|
|
} else {my ($self, $given) = @_; |
2561 |
|
|
|
2562 |
|
|
{ |
2563 |
|
|
|
2564 |
|
|
|
2565 |
|
|
{ |
2566 |
|
|
|
2567 |
|
|
if |
2568 |
|
|
($self-> |
2569 |
|
|
manakai_read_only |
2570 |
|
|
) { |
2571 |
|
|
|
2572 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
2573 |
wakaba |
1.1 |
|
2574 |
|
|
; |
2575 |
|
|
} |
2576 |
|
|
|
2577 |
|
|
|
2578 |
wakaba |
1.3 |
} |
2579 |
wakaba |
1.1 |
|
2580 |
|
|
; |
2581 |
wakaba |
1.13 |
$$self->{ |
2582 |
|
|
'xcs' |
2583 |
|
|
} = $given; |
2584 |
wakaba |
1.1 |
|
2585 |
|
|
|
2586 |
wakaba |
1.3 |
} |
2587 |
wakaba |
1.1 |
} |
2588 |
|
|
} |
2589 |
|
|
sub xml_standalone ($;$) { |
2590 |
|
|
if (@_ == 1) {my ($self) = @_; |
2591 |
|
|
my $r = 0; |
2592 |
|
|
|
2593 |
|
|
{ |
2594 |
|
|
|
2595 |
|
|
|
2596 |
wakaba |
1.13 |
$r = $$self->{ |
2597 |
|
|
'http://www.w3.org/2001/04/infoset#standalone' |
2598 |
|
|
}; |
2599 |
wakaba |
1.1 |
|
2600 |
|
|
|
2601 |
wakaba |
1.3 |
} |
2602 |
wakaba |
1.1 |
$r; |
2603 |
|
|
} else {my ($self, $given) = @_; |
2604 |
|
|
|
2605 |
|
|
{ |
2606 |
|
|
|
2607 |
|
|
|
2608 |
|
|
{ |
2609 |
|
|
|
2610 |
|
|
if |
2611 |
|
|
($self-> |
2612 |
|
|
manakai_read_only |
2613 |
|
|
) { |
2614 |
|
|
|
2615 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
2616 |
wakaba |
1.1 |
|
2617 |
|
|
; |
2618 |
|
|
} |
2619 |
|
|
|
2620 |
|
|
|
2621 |
wakaba |
1.3 |
} |
2622 |
wakaba |
1.1 |
|
2623 |
|
|
; |
2624 |
wakaba |
1.13 |
$$self->{ |
2625 |
|
|
'http://www.w3.org/2001/04/infoset#standalone' |
2626 |
|
|
} = $given; |
2627 |
wakaba |
1.1 |
|
2628 |
|
|
|
2629 |
wakaba |
1.3 |
} |
2630 |
wakaba |
1.1 |
} |
2631 |
|
|
} |
2632 |
|
|
sub adopt_node ($$) { |
2633 |
|
|
my ($self, $source) = @_; |
2634 |
|
|
my $r; |
2635 |
|
|
|
2636 |
|
|
{ |
2637 |
|
|
|
2638 |
wakaba |
1.3 |
ADOPT: |
2639 |
|
|
{ |
2640 |
|
|
last ADOPT |
2641 |
|
|
unless $source->isa ( |
2642 |
wakaba |
1.1 |
'Message::DOM::TreeCore::ManakaiDOMNode' |
2643 |
wakaba |
1.13 |
); |
2644 |
wakaba |
1.3 |
|
2645 |
wakaba |
1.2 |
my $strict = $self-> |
2646 |
|
|
strict_error_checking |
2647 |
|
|
; |
2648 |
|
|
if ($strict and $self-> |
2649 |
wakaba |
1.1 |
manakai_read_only |
2650 |
|
|
) { |
2651 |
|
|
|
2652 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'source'; |
2653 |
|
|
|
2654 |
|
|
; |
2655 |
|
|
} |
2656 |
|
|
my $parent = $source-> |
2657 |
|
|
parent_node |
2658 |
|
|
; |
2659 |
wakaba |
1.2 |
if ($strict and defined $parent and |
2660 |
|
|
$parent-> |
2661 |
wakaba |
1.1 |
manakai_read_only |
2662 |
|
|
) { |
2663 |
|
|
|
2664 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'parent'; |
2665 |
|
|
|
2666 |
|
|
; |
2667 |
|
|
} |
2668 |
|
|
my $nt = $source-> |
2669 |
|
|
node_type |
2670 |
|
|
; |
2671 |
|
|
my $oe; |
2672 |
|
|
if ($nt == |
2673 |
wakaba |
1.7 |
2 |
2674 |
wakaba |
1.1 |
) { |
2675 |
|
|
$oe = $source-> |
2676 |
|
|
owner_element |
2677 |
|
|
; |
2678 |
wakaba |
1.2 |
if ($strict and defined $oe and $oe-> |
2679 |
wakaba |
1.1 |
manakai_read_only |
2680 |
|
|
) { |
2681 |
|
|
|
2682 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'oe'; |
2683 |
|
|
|
2684 |
|
|
; |
2685 |
|
|
} |
2686 |
|
|
} elsif ($nt == |
2687 |
wakaba |
1.7 |
9 or |
2688 |
wakaba |
1.1 |
|
2689 |
|
|
$nt == |
2690 |
wakaba |
1.7 |
10 or |
2691 |
wakaba |
1.1 |
|
2692 |
|
|
$nt == |
2693 |
wakaba |
1.7 |
6 or |
2694 |
wakaba |
1.1 |
|
2695 |
|
|
$nt == |
2696 |
wakaba |
1.7 |
12 |
2697 |
wakaba |
1.1 |
) { |
2698 |
|
|
|
2699 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#ADOPT_NODE_TYPE_NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'source'; |
2700 |
|
|
|
2701 |
|
|
; |
2702 |
|
|
} |
2703 |
|
|
|
2704 |
|
|
my @change_od; |
2705 |
|
|
my @nodes = ($source); |
2706 |
|
|
while (@nodes) { |
2707 |
|
|
my $node = shift @nodes; |
2708 |
|
|
my $nt = $node-> |
2709 |
|
|
node_type |
2710 |
|
|
; |
2711 |
wakaba |
1.2 |
if ($strict and $node-> |
2712 |
wakaba |
1.1 |
manakai_read_only |
2713 |
|
|
) { |
2714 |
|
|
|
2715 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOMOD_DESCENDANT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $node; |
2716 |
|
|
|
2717 |
|
|
; |
2718 |
|
|
} |
2719 |
|
|
if ($nt == |
2720 |
wakaba |
1.7 |
1 |
2721 |
wakaba |
1.1 |
) { |
2722 |
|
|
push @change_od, $node; |
2723 |
|
|
push @nodes, @{$node-> |
2724 |
|
|
child_nodes |
2725 |
|
|
}; |
2726 |
|
|
my $attrs = $node-> |
2727 |
|
|
attributes |
2728 |
|
|
; |
2729 |
|
|
my $attrsLength = $attrs-> |
2730 |
|
|
length |
2731 |
|
|
; |
2732 |
|
|
for my $i (0..($attrsLength - 1)) { |
2733 |
|
|
push @nodes, $attrs-> |
2734 |
|
|
item |
2735 |
|
|
($i); |
2736 |
|
|
} |
2737 |
|
|
} elsif ($nt == |
2738 |
wakaba |
1.7 |
2 or |
2739 |
wakaba |
1.1 |
|
2740 |
|
|
$nt == |
2741 |
wakaba |
1.7 |
5 or |
2742 |
wakaba |
1.1 |
|
2743 |
|
|
$nt == |
2744 |
wakaba |
1.7 |
11 |
2745 |
wakaba |
1.1 |
) { |
2746 |
|
|
push @change_od, $node; |
2747 |
|
|
push @nodes, @{$node-> |
2748 |
|
|
child_nodes |
2749 |
|
|
}; |
2750 |
|
|
} elsif ($nt == |
2751 |
wakaba |
1.7 |
3 or |
2752 |
wakaba |
1.1 |
|
2753 |
|
|
$nt == |
2754 |
wakaba |
1.7 |
8 or |
2755 |
wakaba |
1.1 |
|
2756 |
|
|
$nt == |
2757 |
wakaba |
1.7 |
7 or |
2758 |
wakaba |
1.1 |
|
2759 |
|
|
$nt == |
2760 |
wakaba |
1.7 |
4 |
2761 |
wakaba |
1.1 |
) { |
2762 |
|
|
push @change_od, $node; |
2763 |
|
|
} else { |
2764 |
|
|
## TODO: assertion |
2765 |
|
|
} |
2766 |
|
|
} # nodes |
2767 |
|
|
|
2768 |
wakaba |
1.2 |
|
2769 |
wakaba |
1.1 |
|
2770 |
|
|
{ |
2771 |
|
|
|
2772 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2773 |
|
|
|
2774 |
|
|
{ |
2775 |
|
|
|
2776 |
|
|
|
2777 |
wakaba |
1.2 |
if |
2778 |
|
|
(defined $parent) { |
2779 |
wakaba |
1.1 |
$parent-> |
2780 |
|
|
remove_child |
2781 |
|
|
($source); |
2782 |
wakaba |
1.2 |
} elsif (defined $oe) { |
2783 |
wakaba |
1.1 |
$oe-> |
2784 |
|
|
remove_attribute_node |
2785 |
|
|
($source); |
2786 |
wakaba |
1.2 |
} |
2787 |
|
|
|
2788 |
wakaba |
1.1 |
|
2789 |
|
|
|
2790 |
wakaba |
1.3 |
} |
2791 |
wakaba |
1.1 |
|
2792 |
|
|
|
2793 |
wakaba |
1.13 |
;} |
2794 |
wakaba |
1.1 |
|
2795 |
wakaba |
1.13 |
; |
2796 |
wakaba |
1.1 |
|
2797 |
wakaba |
1.13 |
$r = $source; |
2798 |
|
|
my $old_od = $change_od[0]-> |
2799 |
|
|
owner_document |
2800 |
|
|
; |
2801 |
|
|
## NOTE: The array must have more than zero |
2802 |
|
|
## nodes by definition. In addition, |
2803 |
|
|
## it cannot contain document or document |
2804 |
|
|
## type nodes in current implementation. |
2805 |
wakaba |
1.1 |
|
2806 |
wakaba |
1.13 |
if ($old_od eq $self) { |
2807 |
|
|
last ADOPT; |
2808 |
|
|
} |
2809 |
wakaba |
1.1 |
|
2810 |
wakaba |
1.13 |
for my $n (@change_od) { |
2811 |
|
|
$$n->{ |
2812 |
|
|
'od' |
2813 |
|
|
} = $self; |
2814 |
|
|
Scalar::Util::weaken ($$n->{ |
2815 |
|
|
'od' |
2816 |
|
|
}); |
2817 |
|
|
} |
2818 |
wakaba |
1.1 |
|
2819 |
wakaba |
1.13 |
for my $src (@change_od) { |
2820 |
|
|
my $src_ud = $$src->{ |
2821 |
|
|
'ud' |
2822 |
|
|
}; |
2823 |
wakaba |
1.1 |
for my $key (keys %{$src_ud or {}}) { |
2824 |
|
|
my $dh = $src_ud->{$key}->[1]; |
2825 |
|
|
if ($dh) { |
2826 |
|
|
$dh-> |
2827 |
|
|
handle |
2828 |
|
|
|
2829 |
|
|
( |
2830 |
wakaba |
1.7 |
5 |
2831 |
wakaba |
1.1 |
, |
2832 |
|
|
$key, $src_ud->{$key}->[0], $src, |
2833 |
|
|
undef |
2834 |
|
|
); |
2835 |
|
|
} |
2836 |
|
|
} |
2837 |
|
|
} |
2838 |
wakaba |
1.3 |
} # ADOPT |
2839 |
wakaba |
1.1 |
|
2840 |
|
|
|
2841 |
wakaba |
1.3 |
} |
2842 |
wakaba |
1.1 |
$r} |
2843 |
|
|
sub get_element_by_id ($$) { |
2844 |
|
|
my ($self, $elementId) = @_; |
2845 |
|
|
my $r; |
2846 |
|
|
|
2847 |
|
|
{ |
2848 |
|
|
|
2849 |
|
|
|
2850 |
|
|
{ |
2851 |
|
|
|
2852 |
|
|
local $Error::Depth = $Error::Depth + 1; |
2853 |
|
|
|
2854 |
|
|
{ |
2855 |
|
|
|
2856 |
|
|
|
2857 |
|
|
my |
2858 |
|
|
@nodes = @{$self-> |
2859 |
|
|
child_nodes |
2860 |
|
|
}; |
2861 |
|
|
N: while (@nodes) { |
2862 |
|
|
my $node = shift @nodes; |
2863 |
|
|
next N unless $node-> |
2864 |
|
|
node_type |
2865 |
|
|
== |
2866 |
wakaba |
1.7 |
1 |
2867 |
wakaba |
1.1 |
; |
2868 |
|
|
for my $attr (@{$node-> |
2869 |
|
|
attributes |
2870 |
|
|
}) { |
2871 |
|
|
if ($attr-> |
2872 |
|
|
is_id and |
2873 |
|
|
|
2874 |
|
|
$attr-> |
2875 |
|
|
value eq |
2876 |
|
|
$elementId) { |
2877 |
|
|
$r = $attr; |
2878 |
|
|
last N; |
2879 |
|
|
} |
2880 |
|
|
} |
2881 |
|
|
unshift @nodes, @{$node-> |
2882 |
|
|
child_nodes |
2883 |
|
|
}; |
2884 |
|
|
} # N |
2885 |
|
|
|
2886 |
|
|
|
2887 |
|
|
|
2888 |
wakaba |
1.3 |
} |
2889 |
wakaba |
1.1 |
|
2890 |
|
|
|
2891 |
|
|
;} |
2892 |
|
|
|
2893 |
|
|
; |
2894 |
|
|
|
2895 |
|
|
|
2896 |
wakaba |
1.3 |
} |
2897 |
wakaba |
1.1 |
$r} |
2898 |
|
|
sub get_elements_by_tag_name ($$) { |
2899 |
|
|
my ($self, $name) = @_; |
2900 |
|
|
my $r; |
2901 |
|
|
|
2902 |
|
|
{ |
2903 |
|
|
|
2904 |
|
|
|
2905 |
|
|
$name = "$name"; |
2906 |
|
|
my $chk; |
2907 |
|
|
if ($name eq '*') { |
2908 |
|
|
$chk = sub { |
2909 |
|
|
1 |
2910 |
|
|
}; |
2911 |
|
|
} else { |
2912 |
|
|
$chk = sub { |
2913 |
|
|
my $node = shift; |
2914 |
|
|
my $nodeName = $node-> |
2915 |
|
|
node_name |
2916 |
|
|
; |
2917 |
|
|
($nodeName eq $name); |
2918 |
|
|
}; |
2919 |
|
|
} |
2920 |
|
|
|
2921 |
|
|
|
2922 |
|
|
{ |
2923 |
|
|
|
2924 |
|
|
|
2925 |
|
|
$r = bless \[$self, $chk], |
2926 |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
2927 |
|
|
; |
2928 |
|
|
|
2929 |
|
|
|
2930 |
wakaba |
1.3 |
} |
2931 |
wakaba |
1.1 |
|
2932 |
|
|
; |
2933 |
|
|
|
2934 |
|
|
|
2935 |
wakaba |
1.3 |
} |
2936 |
wakaba |
1.1 |
$r} |
2937 |
|
|
sub get_elements_by_tag_name_ns ($$$) { |
2938 |
|
|
my ($self, $namespaceURI, $localName) = @_; |
2939 |
|
|
|
2940 |
|
|
{ |
2941 |
|
|
|
2942 |
|
|
if |
2943 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
2944 |
wakaba |
1.10 |
require Message::DOM::DOMMain; |
2945 |
wakaba |
1.1 |
|
2946 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:1167465382:17798:gAilE14884'; |
2947 |
wakaba |
1.1 |
|
2948 |
|
|
; |
2949 |
|
|
|
2950 |
wakaba |
1.15 |
$namespaceURI = undef; |
2951 |
wakaba |
1.1 |
} |
2952 |
|
|
|
2953 |
|
|
|
2954 |
wakaba |
1.3 |
} |
2955 |
wakaba |
1.1 |
my $r; |
2956 |
|
|
|
2957 |
|
|
{ |
2958 |
|
|
|
2959 |
|
|
|
2960 |
|
|
$namespaceURI = "$namespaceURI" if defined $namespaceURI; |
2961 |
|
|
$localName = "$localName"; |
2962 |
|
|
my $chk; |
2963 |
|
|
if (not defined $namespaceURI) { |
2964 |
|
|
if ($localName eq '*') { |
2965 |
|
|
$chk = sub { |
2966 |
|
|
my $node = shift; |
2967 |
|
|
(not defined $node-> |
2968 |
|
|
namespace_uri |
2969 |
|
|
); |
2970 |
|
|
}; |
2971 |
|
|
} else { |
2972 |
|
|
$chk = sub { |
2973 |
|
|
my $node = shift; |
2974 |
|
|
(not defined $node-> |
2975 |
|
|
namespace_uri and |
2976 |
|
|
|
2977 |
|
|
$node-> |
2978 |
|
|
local_name eq |
2979 |
|
|
$localName); |
2980 |
|
|
}; |
2981 |
|
|
} |
2982 |
|
|
} elsif ($namespaceURI eq '*') { |
2983 |
|
|
if ($localName eq '*') { |
2984 |
|
|
$chk = sub { |
2985 |
|
|
1 |
2986 |
|
|
}; |
2987 |
|
|
} else { |
2988 |
|
|
$chk = sub { |
2989 |
|
|
my $node = shift; |
2990 |
|
|
($node-> |
2991 |
|
|
local_name eq |
2992 |
|
|
$localName); |
2993 |
|
|
}; |
2994 |
|
|
} |
2995 |
|
|
} else { |
2996 |
|
|
if ($localName eq '*') { |
2997 |
|
|
$chk = sub { |
2998 |
|
|
my $node = shift; |
2999 |
|
|
my $nsuri = $node-> |
3000 |
|
|
namespace_uri |
3001 |
|
|
; |
3002 |
|
|
(defined $nsuri and $nsuri eq $namespaceURI); |
3003 |
|
|
}; |
3004 |
|
|
} else { |
3005 |
|
|
$chk = sub { |
3006 |
|
|
my $node = shift; |
3007 |
|
|
my $nsuri = $node-> |
3008 |
|
|
namespace_uri |
3009 |
|
|
; |
3010 |
|
|
(defined $nsuri and $nsuri eq $namespaceURI and |
3011 |
|
|
$node-> |
3012 |
|
|
local_name eq |
3013 |
|
|
$localName); |
3014 |
|
|
}; |
3015 |
|
|
} |
3016 |
|
|
} |
3017 |
|
|
|
3018 |
|
|
|
3019 |
|
|
{ |
3020 |
|
|
|
3021 |
|
|
|
3022 |
|
|
$r = bless \[$self, $chk], |
3023 |
|
|
'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' |
3024 |
|
|
; |
3025 |
|
|
|
3026 |
|
|
|
3027 |
wakaba |
1.3 |
} |
3028 |
wakaba |
1.1 |
|
3029 |
|
|
; |
3030 |
|
|
|
3031 |
|
|
|
3032 |
wakaba |
1.3 |
} |
3033 |
wakaba |
1.1 |
$r} |
3034 |
|
|
sub import_node ($$;$) { |
3035 |
|
|
my ($self, $importedNode, $deep) = @_; |
3036 |
|
|
my $r; |
3037 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'import_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
3038 |
|
|
$r} |
3039 |
|
|
sub normalize_document ($) { |
3040 |
|
|
my ($self) = @_; |
3041 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'normalize_document', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
3042 |
|
|
} |
3043 |
|
|
sub rename_node ($$$$) { |
3044 |
|
|
my ($self, $n, $namespaceURI, $qualifiedName) = @_; |
3045 |
|
|
|
3046 |
|
|
{ |
3047 |
|
|
|
3048 |
|
|
if |
3049 |
|
|
(CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { |
3050 |
wakaba |
1.10 |
require Message::DOM::DOMMain; |
3051 |
wakaba |
1.1 |
|
3052 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:1167465382:17798:gAilE14884'; |
3053 |
wakaba |
1.1 |
|
3054 |
|
|
; |
3055 |
|
|
|
3056 |
wakaba |
1.15 |
$namespaceURI = undef; |
3057 |
wakaba |
1.1 |
} |
3058 |
|
|
|
3059 |
|
|
|
3060 |
wakaba |
1.3 |
} |
3061 |
wakaba |
1.1 |
my $r; |
3062 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'rename_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; |
3063 |
|
|
$r} |
3064 |
|
|
sub manakai_entity_base_uri ($;$) { |
3065 |
|
|
if (@_ == 1) {my ($self) = @_; |
3066 |
wakaba |
1.12 |
my $r = ''; |
3067 |
wakaba |
1.1 |
|
3068 |
|
|
{ |
3069 |
|
|
|
3070 |
|
|
|
3071 |
wakaba |
1.13 |
$r = $$self->{ |
3072 |
|
|
'buri' |
3073 |
|
|
}; |
3074 |
wakaba |
1.1 |
unless (defined $r) { |
3075 |
wakaba |
1.13 |
$r = $$self->{ |
3076 |
|
|
'duri' |
3077 |
|
|
}; |
3078 |
wakaba |
1.1 |
} |
3079 |
|
|
|
3080 |
|
|
|
3081 |
wakaba |
1.3 |
} |
3082 |
wakaba |
1.1 |
$r; |
3083 |
|
|
} else {my ($self, $given) = @_; |
3084 |
|
|
|
3085 |
|
|
{ |
3086 |
|
|
|
3087 |
|
|
|
3088 |
|
|
{ |
3089 |
|
|
|
3090 |
|
|
if |
3091 |
|
|
($self-> |
3092 |
|
|
manakai_read_only |
3093 |
|
|
) { |
3094 |
|
|
|
3095 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
3096 |
wakaba |
1.1 |
|
3097 |
|
|
; |
3098 |
|
|
} |
3099 |
|
|
|
3100 |
|
|
|
3101 |
wakaba |
1.3 |
} |
3102 |
wakaba |
1.1 |
|
3103 |
|
|
; |
3104 |
wakaba |
1.13 |
$$self->{ |
3105 |
|
|
'buri' |
3106 |
|
|
} = $given; |
3107 |
wakaba |
1.1 |
|
3108 |
|
|
|
3109 |
wakaba |
1.3 |
} |
3110 |
wakaba |
1.1 |
} |
3111 |
|
|
} |
3112 |
|
|
sub all_declarations_processed ($;$) { |
3113 |
|
|
if (@_ == 1) {my ($self) = @_; |
3114 |
|
|
my $r = 0; |
3115 |
|
|
|
3116 |
|
|
{ |
3117 |
|
|
|
3118 |
|
|
|
3119 |
wakaba |
1.13 |
$r = $$self->{ |
3120 |
|
|
'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed' |
3121 |
|
|
}; |
3122 |
wakaba |
1.1 |
|
3123 |
|
|
|
3124 |
wakaba |
1.3 |
} |
3125 |
wakaba |
1.1 |
$r; |
3126 |
|
|
} else {my ($self, $given) = @_; |
3127 |
|
|
|
3128 |
|
|
{ |
3129 |
|
|
|
3130 |
|
|
|
3131 |
|
|
{ |
3132 |
|
|
|
3133 |
|
|
if |
3134 |
|
|
($self-> |
3135 |
|
|
manakai_read_only |
3136 |
|
|
) { |
3137 |
|
|
|
3138 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError'; |
3139 |
wakaba |
1.1 |
|
3140 |
|
|
; |
3141 |
|
|
} |
3142 |
|
|
|
3143 |
|
|
|
3144 |
wakaba |
1.3 |
} |
3145 |
wakaba |
1.1 |
|
3146 |
|
|
; |
3147 |
wakaba |
1.13 |
$$self->{ |
3148 |
|
|
'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed' |
3149 |
|
|
} = $given; |
3150 |
wakaba |
1.1 |
|
3151 |
|
|
|
3152 |
wakaba |
1.3 |
} |
3153 |
wakaba |
1.1 |
} |
3154 |
|
|
} |
3155 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocument>}->{has_feature} = {'core', |
3156 |
|
|
{'', |
3157 |
|
|
'1', |
3158 |
|
|
'1.0', |
3159 |
|
|
'1', |
3160 |
|
|
'2.0', |
3161 |
|
|
'1', |
3162 |
|
|
'3.0', |
3163 |
|
|
'1'}, |
3164 |
|
|
'xml', |
3165 |
|
|
{'', |
3166 |
|
|
'1', |
3167 |
|
|
'1.0', |
3168 |
|
|
'1', |
3169 |
|
|
'2.0', |
3170 |
|
|
'1', |
3171 |
|
|
'3.0', |
3172 |
|
|
'1'}, |
3173 |
|
|
'xmlversion', |
3174 |
|
|
{'', |
3175 |
|
|
'1', |
3176 |
|
|
'1.0', |
3177 |
|
|
'1', |
3178 |
|
|
'1.1', |
3179 |
|
|
'1'}}; |
3180 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocument>} = 14.1; |
3181 |
wakaba |
1.15 |
package Message::DOM::IF::DocumentFragment; |
3182 |
|
|
our $VERSION = 20061230.0809; |
3183 |
wakaba |
1.1 |
package Message::DOM::Document::ManakaiDOMDocumentFragment; |
3184 |
wakaba |
1.15 |
our $VERSION = 20061230.0809; |
3185 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', |
3186 |
wakaba |
1.15 |
'Message::DOM::IF::DocumentFragment', |
3187 |
|
|
'Message::DOM::IF::Node'; |
3188 |
wakaba |
1.1 |
sub node_type ($;$) { |
3189 |
|
|
if (@_ == 1) {my ($self) = @_; |
3190 |
|
|
my $r; |
3191 |
wakaba |
1.7 |
$r = 11; |
3192 |
wakaba |
1.1 |
$r; |
3193 |
|
|
} else {my ($self) = @_; |
3194 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; |
3195 |
|
|
} |
3196 |
|
|
} |
3197 |
|
|
sub append_child ($$) { |
3198 |
|
|
my ($self, $newChild) = @_; |
3199 |
|
|
my $r; |
3200 |
|
|
|
3201 |
|
|
{ |
3202 |
|
|
|
3203 |
|
|
if |
3204 |
|
|
($self eq $newChild) { |
3205 |
|
|
|
3206 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; |
3207 |
|
|
|
3208 |
|
|
; |
3209 |
|
|
} |
3210 |
|
|
my $self_od = $self-> |
3211 |
|
|
owner_document |
3212 |
|
|
; |
3213 |
|
|
my $child_od = $newChild-> |
3214 |
|
|
owner_document |
3215 |
|
|
; |
3216 |
|
|
my $child_nt = $newChild-> |
3217 |
|
|
node_type |
3218 |
|
|
; |
3219 |
|
|
|
3220 |
|
|
|
3221 |
|
|
{ |
3222 |
|
|
|
3223 |
|
|
|
3224 |
|
|
{ |
3225 |
|
|
|
3226 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3227 |
|
|
|
3228 |
|
|
{ |
3229 |
|
|
|
3230 |
|
|
|
3231 |
|
|
my |
3232 |
|
|
$strict = $self_od-> |
3233 |
|
|
strict_error_checking |
3234 |
|
|
; |
3235 |
|
|
|
3236 |
|
|
## -- Node Type check |
3237 |
|
|
my @new_child; |
3238 |
|
|
if ({ |
3239 |
wakaba |
1.7 |
3 => 1, |
3240 |
|
|
5 => 1, |
3241 |
|
|
1 => 1, |
3242 |
|
|
7 => 1, |
3243 |
|
|
4 => 1, |
3244 |
|
|
8 => 1, |
3245 |
wakaba |
1.1 |
}->{$child_nt}) { |
3246 |
|
|
push @new_child, $newChild; |
3247 |
|
|
} elsif ($child_nt == |
3248 |
wakaba |
1.7 |
11 |
3249 |
wakaba |
1.1 |
) { |
3250 |
|
|
for my $cn (@{$newChild-> |
3251 |
|
|
child_nodes |
3252 |
|
|
}) { |
3253 |
|
|
unless ({ |
3254 |
wakaba |
1.7 |
3 => 1, |
3255 |
|
|
5 => 1, |
3256 |
|
|
1 => 1, |
3257 |
|
|
7 => 1, |
3258 |
|
|
4 => 1, |
3259 |
|
|
8 => 1, |
3260 |
wakaba |
1.1 |
}->{$cn-> |
3261 |
|
|
node_type |
3262 |
|
|
}) { |
3263 |
|
|
|
3264 |
|
|
|
3265 |
|
|
{ |
3266 |
|
|
|
3267 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3268 |
|
|
|
3269 |
|
|
{ |
3270 |
|
|
|
3271 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
3272 |
wakaba |
1.1 |
|
3273 |
|
|
|
3274 |
wakaba |
1.3 |
} |
3275 |
wakaba |
1.1 |
|
3276 |
|
|
|
3277 |
|
|
;} |
3278 |
|
|
|
3279 |
|
|
; |
3280 |
|
|
} |
3281 |
|
|
push @new_child, $cn; |
3282 |
|
|
} |
3283 |
|
|
} else { |
3284 |
|
|
|
3285 |
|
|
|
3286 |
|
|
{ |
3287 |
|
|
|
3288 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3289 |
|
|
|
3290 |
|
|
{ |
3291 |
|
|
|
3292 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
3293 |
wakaba |
1.1 |
|
3294 |
|
|
|
3295 |
wakaba |
1.3 |
} |
3296 |
wakaba |
1.1 |
|
3297 |
|
|
|
3298 |
|
|
;} |
3299 |
|
|
|
3300 |
|
|
; |
3301 |
|
|
} |
3302 |
|
|
|
3303 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
3304 |
|
|
parent_node |
3305 |
|
|
: |
3306 |
|
|
|
3307 |
|
|
undef |
3308 |
|
|
; |
3309 |
|
|
if ($strict) { |
3310 |
|
|
## -- Wrong-document check |
3311 |
|
|
unless ($self_od eq $child_od) { |
3312 |
|
|
|
3313 |
|
|
|
3314 |
|
|
{ |
3315 |
|
|
|
3316 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3317 |
|
|
|
3318 |
|
|
{ |
3319 |
|
|
|
3320 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
3321 |
wakaba |
1.1 |
|
3322 |
|
|
|
3323 |
wakaba |
1.3 |
} |
3324 |
wakaba |
1.1 |
|
3325 |
|
|
|
3326 |
|
|
;} |
3327 |
|
|
|
3328 |
|
|
; |
3329 |
|
|
} |
3330 |
|
|
|
3331 |
|
|
## -- Read-onlyness check |
3332 |
|
|
if ($self-> |
3333 |
|
|
manakai_read_only |
3334 |
|
|
) { |
3335 |
|
|
|
3336 |
|
|
|
3337 |
|
|
{ |
3338 |
|
|
|
3339 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3340 |
|
|
|
3341 |
|
|
{ |
3342 |
|
|
|
3343 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1'; |
3344 |
wakaba |
1.1 |
|
3345 |
|
|
|
3346 |
wakaba |
1.3 |
} |
3347 |
wakaba |
1.1 |
|
3348 |
|
|
|
3349 |
|
|
;} |
3350 |
|
|
|
3351 |
|
|
; |
3352 |
|
|
} |
3353 |
|
|
if (@new_child) { |
3354 |
|
|
if ($nc_parent and |
3355 |
|
|
$nc_parent-> |
3356 |
|
|
manakai_read_only |
3357 |
|
|
) { |
3358 |
|
|
|
3359 |
|
|
|
3360 |
|
|
{ |
3361 |
|
|
|
3362 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3363 |
|
|
|
3364 |
|
|
{ |
3365 |
|
|
|
3366 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1'; |
3367 |
wakaba |
1.1 |
|
3368 |
|
|
|
3369 |
wakaba |
1.3 |
} |
3370 |
wakaba |
1.1 |
|
3371 |
|
|
|
3372 |
|
|
;} |
3373 |
|
|
|
3374 |
|
|
; |
3375 |
|
|
} |
3376 |
|
|
} |
3377 |
|
|
} |
3378 |
|
|
|
3379 |
|
|
## -- Insert at... |
3380 |
|
|
my $index = -1; # last |
3381 |
|
|
|
3382 |
|
|
|
3383 |
|
|
; # FOR !tc:ForAppendChild |
3384 |
|
|
|
3385 |
|
|
## -- Removes from parent |
3386 |
|
|
if ($nc_parent) { |
3387 |
|
|
if ($child_nt == |
3388 |
wakaba |
1.7 |
11 |
3389 |
wakaba |
1.1 |
) { |
3390 |
wakaba |
1.13 |
$$newChild->{ |
3391 |
|
|
'child' |
3392 |
|
|
} = []; |
3393 |
wakaba |
1.1 |
} else { |
3394 |
wakaba |
1.13 |
my $v = $$nc_parent->{ |
3395 |
|
|
'child' |
3396 |
|
|
}; |
3397 |
wakaba |
1.1 |
RP: for my $i (0..$#$v) { |
3398 |
wakaba |
1.13 |
if ($v->[$i] eq $new_child[0]) { |
3399 |
wakaba |
1.1 |
splice @$v, $i, 1, (); |
3400 |
|
|
last RP; |
3401 |
|
|
} |
3402 |
|
|
} # RP |
3403 |
|
|
} |
3404 |
|
|
} |
3405 |
|
|
|
3406 |
|
|
## -- Rewrite the |parentNode| properties |
3407 |
|
|
for my $nc (@new_child) { |
3408 |
wakaba |
1.13 |
$$nc->{ |
3409 |
|
|
'parent' |
3410 |
|
|
} = $self; |
3411 |
|
|
Scalar::Util::weaken ($$nc->{ |
3412 |
|
|
'parent' |
3413 |
|
|
}); |
3414 |
|
|
} |
3415 |
wakaba |
1.1 |
|
3416 |
wakaba |
1.13 |
my $children = $$self->{ |
3417 |
|
|
'child' |
3418 |
wakaba |
1.1 |
}; |
3419 |
|
|
|
3420 |
|
|
|
3421 |
|
|
|
3422 |
|
|
{ |
3423 |
|
|
|
3424 |
|
|
|
3425 |
|
|
## -- Adds to children list |
3426 |
wakaba |
1.13 |
push @$children, @new_child; |
3427 |
wakaba |
1.1 |
$r = $newChild; |
3428 |
|
|
|
3429 |
|
|
|
3430 |
|
|
|
3431 |
wakaba |
1.3 |
} |
3432 |
wakaba |
1.1 |
|
3433 |
|
|
; |
3434 |
|
|
|
3435 |
|
|
|
3436 |
|
|
|
3437 |
|
|
; |
3438 |
|
|
|
3439 |
|
|
|
3440 |
|
|
|
3441 |
|
|
; |
3442 |
|
|
|
3443 |
|
|
|
3444 |
|
|
|
3445 |
wakaba |
1.3 |
} |
3446 |
wakaba |
1.1 |
|
3447 |
|
|
|
3448 |
|
|
;} |
3449 |
|
|
|
3450 |
|
|
; |
3451 |
|
|
|
3452 |
|
|
|
3453 |
wakaba |
1.3 |
} |
3454 |
wakaba |
1.1 |
|
3455 |
|
|
; |
3456 |
|
|
|
3457 |
|
|
|
3458 |
wakaba |
1.3 |
} |
3459 |
wakaba |
1.1 |
$r} |
3460 |
|
|
sub insert_before ($$;$) { |
3461 |
|
|
my ($self, $newChild, $refChild) = @_; |
3462 |
|
|
my $r; |
3463 |
|
|
|
3464 |
|
|
{ |
3465 |
|
|
|
3466 |
|
|
if |
3467 |
|
|
($self eq $newChild) { |
3468 |
|
|
|
3469 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; |
3470 |
|
|
|
3471 |
|
|
; |
3472 |
|
|
} |
3473 |
|
|
my $self_od = $self-> |
3474 |
|
|
owner_document |
3475 |
|
|
; |
3476 |
|
|
my $child_od = $newChild-> |
3477 |
|
|
owner_document |
3478 |
|
|
; |
3479 |
|
|
my $child_nt = $newChild-> |
3480 |
|
|
node_type |
3481 |
|
|
; |
3482 |
|
|
|
3483 |
|
|
|
3484 |
|
|
{ |
3485 |
|
|
|
3486 |
|
|
|
3487 |
|
|
{ |
3488 |
|
|
|
3489 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3490 |
|
|
|
3491 |
|
|
{ |
3492 |
|
|
|
3493 |
|
|
|
3494 |
|
|
my |
3495 |
|
|
$strict = $self_od-> |
3496 |
|
|
strict_error_checking |
3497 |
|
|
; |
3498 |
|
|
|
3499 |
|
|
## -- Node Type check |
3500 |
|
|
my @new_child; |
3501 |
|
|
if ({ |
3502 |
wakaba |
1.7 |
3 => 1, |
3503 |
|
|
5 => 1, |
3504 |
|
|
1 => 1, |
3505 |
|
|
7 => 1, |
3506 |
|
|
4 => 1, |
3507 |
|
|
8 => 1, |
3508 |
wakaba |
1.1 |
}->{$child_nt}) { |
3509 |
|
|
push @new_child, $newChild; |
3510 |
|
|
} elsif ($child_nt == |
3511 |
wakaba |
1.7 |
11 |
3512 |
wakaba |
1.1 |
) { |
3513 |
|
|
for my $cn (@{$newChild-> |
3514 |
|
|
child_nodes |
3515 |
|
|
}) { |
3516 |
|
|
unless ({ |
3517 |
wakaba |
1.7 |
3 => 1, |
3518 |
|
|
5 => 1, |
3519 |
|
|
1 => 1, |
3520 |
|
|
7 => 1, |
3521 |
|
|
4 => 1, |
3522 |
|
|
8 => 1, |
3523 |
wakaba |
1.1 |
}->{$cn-> |
3524 |
|
|
node_type |
3525 |
|
|
}) { |
3526 |
|
|
|
3527 |
|
|
|
3528 |
|
|
{ |
3529 |
|
|
|
3530 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3531 |
|
|
|
3532 |
|
|
{ |
3533 |
|
|
|
3534 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
3535 |
wakaba |
1.1 |
|
3536 |
|
|
|
3537 |
wakaba |
1.3 |
} |
3538 |
wakaba |
1.1 |
|
3539 |
|
|
|
3540 |
|
|
;} |
3541 |
|
|
|
3542 |
|
|
; |
3543 |
|
|
} |
3544 |
|
|
push @new_child, $cn; |
3545 |
|
|
} |
3546 |
|
|
} else { |
3547 |
|
|
|
3548 |
|
|
|
3549 |
|
|
{ |
3550 |
|
|
|
3551 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3552 |
|
|
|
3553 |
|
|
{ |
3554 |
|
|
|
3555 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
3556 |
wakaba |
1.1 |
|
3557 |
|
|
|
3558 |
wakaba |
1.3 |
} |
3559 |
wakaba |
1.1 |
|
3560 |
|
|
|
3561 |
|
|
;} |
3562 |
|
|
|
3563 |
|
|
; |
3564 |
|
|
} |
3565 |
|
|
|
3566 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
3567 |
|
|
parent_node |
3568 |
|
|
: |
3569 |
|
|
|
3570 |
|
|
undef |
3571 |
|
|
; |
3572 |
|
|
if ($strict) { |
3573 |
|
|
## -- Wrong-document check |
3574 |
|
|
unless ($self_od eq $child_od) { |
3575 |
|
|
|
3576 |
|
|
|
3577 |
|
|
{ |
3578 |
|
|
|
3579 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3580 |
|
|
|
3581 |
|
|
{ |
3582 |
|
|
|
3583 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
3584 |
wakaba |
1.1 |
|
3585 |
|
|
|
3586 |
wakaba |
1.3 |
} |
3587 |
wakaba |
1.1 |
|
3588 |
|
|
|
3589 |
|
|
;} |
3590 |
|
|
|
3591 |
|
|
; |
3592 |
|
|
} |
3593 |
|
|
|
3594 |
|
|
## -- Read-onlyness check |
3595 |
|
|
if ($self-> |
3596 |
|
|
manakai_read_only |
3597 |
|
|
) { |
3598 |
|
|
|
3599 |
|
|
|
3600 |
|
|
{ |
3601 |
|
|
|
3602 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3603 |
|
|
|
3604 |
|
|
{ |
3605 |
|
|
|
3606 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1'; |
3607 |
wakaba |
1.1 |
|
3608 |
|
|
|
3609 |
wakaba |
1.3 |
} |
3610 |
wakaba |
1.1 |
|
3611 |
|
|
|
3612 |
|
|
;} |
3613 |
|
|
|
3614 |
|
|
; |
3615 |
|
|
} |
3616 |
|
|
if (@new_child) { |
3617 |
|
|
if ($nc_parent and |
3618 |
|
|
$nc_parent-> |
3619 |
|
|
manakai_read_only |
3620 |
|
|
) { |
3621 |
|
|
|
3622 |
|
|
|
3623 |
|
|
{ |
3624 |
|
|
|
3625 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3626 |
|
|
|
3627 |
|
|
{ |
3628 |
|
|
|
3629 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1'; |
3630 |
wakaba |
1.1 |
|
3631 |
|
|
|
3632 |
wakaba |
1.3 |
} |
3633 |
wakaba |
1.1 |
|
3634 |
|
|
|
3635 |
|
|
;} |
3636 |
|
|
|
3637 |
|
|
; |
3638 |
|
|
} |
3639 |
|
|
} |
3640 |
|
|
} |
3641 |
|
|
|
3642 |
|
|
## -- Insert at... |
3643 |
|
|
my $index = -1; # last |
3644 |
|
|
|
3645 |
|
|
|
3646 |
|
|
{ |
3647 |
|
|
|
3648 |
|
|
|
3649 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
3650 |
|
|
if (defined $refChild) { |
3651 |
|
|
if ($refChild eq $newChild) { |
3652 |
|
|
|
3653 |
|
|
|
3654 |
|
|
{ |
3655 |
|
|
|
3656 |
|
|
|
3657 |
|
|
{ |
3658 |
|
|
|
3659 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3660 |
|
|
|
3661 |
|
|
{ |
3662 |
|
|
|
3663 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#insert-before-itself', 'rdata' => $refChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1'; |
3664 |
wakaba |
1.1 |
|
3665 |
|
|
|
3666 |
wakaba |
1.3 |
} |
3667 |
wakaba |
1.1 |
|
3668 |
|
|
|
3669 |
|
|
;} |
3670 |
|
|
|
3671 |
|
|
; |
3672 |
|
|
|
3673 |
|
|
|
3674 |
|
|
|
3675 |
wakaba |
1.3 |
} |
3676 |
wakaba |
1.1 |
|
3677 |
|
|
; |
3678 |
|
|
|
3679 |
|
|
|
3680 |
|
|
; |
3681 |
|
|
} |
3682 |
|
|
|
3683 |
|
|
my $cns = $self-> |
3684 |
|
|
child_nodes |
3685 |
|
|
; |
3686 |
|
|
my $cnsl = @$cns; |
3687 |
|
|
C: { |
3688 |
|
|
$index = 0; |
3689 |
|
|
for my $i (0..($cnsl-1)) { |
3690 |
|
|
my $cn = $cns->[$i]; |
3691 |
|
|
if ($cn eq $refChild) { |
3692 |
|
|
$index += $i; |
3693 |
|
|
last C; |
3694 |
|
|
} elsif ($cn eq $newChild) { |
3695 |
|
|
$index = -1; # offset |
3696 |
|
|
} |
3697 |
|
|
} |
3698 |
|
|
|
3699 |
|
|
|
3700 |
|
|
{ |
3701 |
|
|
|
3702 |
|
|
|
3703 |
|
|
{ |
3704 |
|
|
|
3705 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3706 |
|
|
|
3707 |
|
|
{ |
3708 |
|
|
|
3709 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'refChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $refChild; |
3710 |
wakaba |
1.1 |
|
3711 |
|
|
|
3712 |
wakaba |
1.3 |
} |
3713 |
wakaba |
1.1 |
|
3714 |
|
|
|
3715 |
|
|
;} |
3716 |
|
|
|
3717 |
|
|
; |
3718 |
|
|
|
3719 |
|
|
|
3720 |
|
|
|
3721 |
wakaba |
1.3 |
} |
3722 |
wakaba |
1.1 |
|
3723 |
|
|
; |
3724 |
|
|
|
3725 |
|
|
|
3726 |
|
|
; |
3727 |
|
|
} # C |
3728 |
|
|
} else { # |oldChild| is not defined |
3729 |
|
|
|
3730 |
|
|
|
3731 |
|
|
; |
3732 |
|
|
} |
3733 |
|
|
|
3734 |
|
|
|
3735 |
|
|
|
3736 |
wakaba |
1.3 |
} |
3737 |
wakaba |
1.1 |
|
3738 |
|
|
; # FOR !tc:ForAppendChild |
3739 |
|
|
|
3740 |
|
|
## -- Removes from parent |
3741 |
|
|
if ($nc_parent) { |
3742 |
|
|
if ($child_nt == |
3743 |
wakaba |
1.7 |
11 |
3744 |
wakaba |
1.1 |
) { |
3745 |
wakaba |
1.13 |
$$newChild->{ |
3746 |
|
|
'child' |
3747 |
|
|
} = []; |
3748 |
wakaba |
1.1 |
} else { |
3749 |
wakaba |
1.13 |
my $v = $$nc_parent->{ |
3750 |
|
|
'child' |
3751 |
|
|
}; |
3752 |
wakaba |
1.1 |
RP: for my $i (0..$#$v) { |
3753 |
wakaba |
1.13 |
if ($v->[$i] eq $new_child[0]) { |
3754 |
wakaba |
1.1 |
splice @$v, $i, 1, (); |
3755 |
|
|
last RP; |
3756 |
|
|
} |
3757 |
|
|
} # RP |
3758 |
|
|
} |
3759 |
|
|
} |
3760 |
|
|
|
3761 |
|
|
## -- Rewrite the |parentNode| properties |
3762 |
|
|
for my $nc (@new_child) { |
3763 |
wakaba |
1.13 |
$$nc->{ |
3764 |
|
|
'parent' |
3765 |
|
|
} = $self; |
3766 |
|
|
Scalar::Util::weaken ($$nc->{ |
3767 |
|
|
'parent' |
3768 |
|
|
}); |
3769 |
|
|
} |
3770 |
wakaba |
1.1 |
|
3771 |
wakaba |
1.13 |
my $children = $$self->{ |
3772 |
|
|
'child' |
3773 |
wakaba |
1.1 |
}; |
3774 |
|
|
|
3775 |
|
|
|
3776 |
|
|
|
3777 |
|
|
; |
3778 |
|
|
|
3779 |
|
|
|
3780 |
|
|
|
3781 |
|
|
{ |
3782 |
|
|
|
3783 |
|
|
|
3784 |
|
|
## -- Adds to children list |
3785 |
|
|
if ($index == -1) { |
3786 |
wakaba |
1.13 |
push @$children, @new_child; |
3787 |
wakaba |
1.1 |
} else { |
3788 |
wakaba |
1.13 |
splice @$children, $index, 0, @new_child; |
3789 |
wakaba |
1.1 |
} |
3790 |
|
|
$r = $newChild; |
3791 |
|
|
|
3792 |
|
|
|
3793 |
|
|
|
3794 |
wakaba |
1.3 |
} |
3795 |
wakaba |
1.1 |
|
3796 |
|
|
; |
3797 |
|
|
|
3798 |
|
|
|
3799 |
|
|
|
3800 |
|
|
; |
3801 |
|
|
|
3802 |
|
|
|
3803 |
|
|
|
3804 |
wakaba |
1.3 |
} |
3805 |
wakaba |
1.1 |
|
3806 |
|
|
|
3807 |
|
|
;} |
3808 |
|
|
|
3809 |
|
|
; |
3810 |
|
|
|
3811 |
|
|
|
3812 |
wakaba |
1.3 |
} |
3813 |
wakaba |
1.1 |
|
3814 |
|
|
; |
3815 |
|
|
|
3816 |
|
|
|
3817 |
wakaba |
1.3 |
} |
3818 |
wakaba |
1.1 |
$r} |
3819 |
|
|
sub replace_child ($$$) { |
3820 |
|
|
my ($self, $newChild, $oldChild) = @_; |
3821 |
|
|
my $r; |
3822 |
|
|
|
3823 |
|
|
{ |
3824 |
|
|
|
3825 |
|
|
if |
3826 |
|
|
($self eq $newChild) { |
3827 |
|
|
|
3828 |
|
|
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; |
3829 |
|
|
|
3830 |
|
|
; |
3831 |
|
|
} |
3832 |
|
|
my $self_od = $self-> |
3833 |
|
|
owner_document |
3834 |
|
|
; |
3835 |
|
|
my $child_od = $newChild-> |
3836 |
|
|
owner_document |
3837 |
|
|
; |
3838 |
|
|
my $child_nt = $newChild-> |
3839 |
|
|
node_type |
3840 |
|
|
; |
3841 |
|
|
|
3842 |
|
|
|
3843 |
|
|
{ |
3844 |
|
|
|
3845 |
|
|
|
3846 |
|
|
{ |
3847 |
|
|
|
3848 |
|
|
local $Error::Depth = $Error::Depth + 1; |
3849 |
|
|
|
3850 |
|
|
{ |
3851 |
|
|
|
3852 |
|
|
|
3853 |
|
|
my |
3854 |
|
|
$strict = $self_od-> |
3855 |
|
|
strict_error_checking |
3856 |
|
|
; |
3857 |
|
|
|
3858 |
|
|
## -- Node Type check |
3859 |
|
|
my @new_child; |
3860 |
|
|
if ({ |
3861 |
wakaba |
1.7 |
3 => 1, |
3862 |
|
|
5 => 1, |
3863 |
|
|
1 => 1, |
3864 |
|
|
7 => 1, |
3865 |
|
|
4 => 1, |
3866 |
|
|
8 => 1, |
3867 |
wakaba |
1.1 |
}->{$child_nt}) { |
3868 |
|
|
push @new_child, $newChild; |
3869 |
|
|
} elsif ($child_nt == |
3870 |
wakaba |
1.7 |
11 |
3871 |
wakaba |
1.1 |
) { |
3872 |
|
|
for my $cn (@{$newChild-> |
3873 |
|
|
child_nodes |
3874 |
|
|
}) { |
3875 |
|
|
unless ({ |
3876 |
wakaba |
1.7 |
3 => 1, |
3877 |
|
|
5 => 1, |
3878 |
|
|
1 => 1, |
3879 |
|
|
7 => 1, |
3880 |
|
|
4 => 1, |
3881 |
|
|
8 => 1, |
3882 |
wakaba |
1.1 |
}->{$cn-> |
3883 |
|
|
node_type |
3884 |
|
|
}) { |
3885 |
|
|
|
3886 |
|
|
|
3887 |
|
|
{ |
3888 |
|
|
|
3889 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3890 |
|
|
|
3891 |
|
|
{ |
3892 |
|
|
|
3893 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
3894 |
wakaba |
1.1 |
|
3895 |
|
|
|
3896 |
wakaba |
1.3 |
} |
3897 |
wakaba |
1.1 |
|
3898 |
|
|
|
3899 |
|
|
;} |
3900 |
|
|
|
3901 |
|
|
; |
3902 |
|
|
} |
3903 |
|
|
push @new_child, $cn; |
3904 |
|
|
} |
3905 |
|
|
} else { |
3906 |
|
|
|
3907 |
|
|
|
3908 |
|
|
{ |
3909 |
|
|
|
3910 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3911 |
|
|
|
3912 |
|
|
{ |
3913 |
|
|
|
3914 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
3915 |
wakaba |
1.1 |
|
3916 |
|
|
|
3917 |
wakaba |
1.3 |
} |
3918 |
wakaba |
1.1 |
|
3919 |
|
|
|
3920 |
|
|
;} |
3921 |
|
|
|
3922 |
|
|
; |
3923 |
|
|
} |
3924 |
|
|
|
3925 |
|
|
my $nc_parent = @new_child ? $new_child[0]-> |
3926 |
|
|
parent_node |
3927 |
|
|
: |
3928 |
|
|
|
3929 |
|
|
undef |
3930 |
|
|
; |
3931 |
|
|
if ($strict) { |
3932 |
|
|
## -- Wrong-document check |
3933 |
|
|
unless ($self_od eq $child_od) { |
3934 |
|
|
|
3935 |
|
|
|
3936 |
|
|
{ |
3937 |
|
|
|
3938 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3939 |
|
|
|
3940 |
|
|
{ |
3941 |
|
|
|
3942 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; |
3943 |
wakaba |
1.1 |
|
3944 |
|
|
|
3945 |
wakaba |
1.3 |
} |
3946 |
wakaba |
1.1 |
|
3947 |
|
|
|
3948 |
|
|
;} |
3949 |
|
|
|
3950 |
|
|
; |
3951 |
|
|
} |
3952 |
|
|
|
3953 |
|
|
## -- Read-onlyness check |
3954 |
|
|
if ($self-> |
3955 |
|
|
manakai_read_only |
3956 |
|
|
) { |
3957 |
|
|
|
3958 |
|
|
|
3959 |
|
|
{ |
3960 |
|
|
|
3961 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3962 |
|
|
|
3963 |
|
|
{ |
3964 |
|
|
|
3965 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1'; |
3966 |
wakaba |
1.1 |
|
3967 |
|
|
|
3968 |
wakaba |
1.3 |
} |
3969 |
wakaba |
1.1 |
|
3970 |
|
|
|
3971 |
|
|
;} |
3972 |
|
|
|
3973 |
|
|
; |
3974 |
|
|
} |
3975 |
|
|
if (@new_child) { |
3976 |
|
|
if ($nc_parent and |
3977 |
|
|
$nc_parent-> |
3978 |
|
|
manakai_read_only |
3979 |
|
|
) { |
3980 |
|
|
|
3981 |
|
|
|
3982 |
|
|
{ |
3983 |
|
|
|
3984 |
|
|
local $Error::Depth = $Error::Depth - 1; |
3985 |
|
|
|
3986 |
|
|
{ |
3987 |
|
|
|
3988 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1'; |
3989 |
wakaba |
1.1 |
|
3990 |
|
|
|
3991 |
wakaba |
1.3 |
} |
3992 |
wakaba |
1.1 |
|
3993 |
|
|
|
3994 |
|
|
;} |
3995 |
|
|
|
3996 |
|
|
; |
3997 |
|
|
} |
3998 |
|
|
} |
3999 |
|
|
} |
4000 |
|
|
|
4001 |
|
|
## -- Insert at... |
4002 |
|
|
my $index = -1; # last |
4003 |
|
|
|
4004 |
|
|
|
4005 |
|
|
{ |
4006 |
|
|
|
4007 |
|
|
|
4008 |
|
|
# tc:ForAppendChild & tc:ForReplaceChild |
4009 |
|
|
if (defined $oldChild) { |
4010 |
|
|
if ($oldChild eq $newChild) { |
4011 |
|
|
|
4012 |
|
|
|
4013 |
|
|
; |
4014 |
|
|
|
4015 |
|
|
|
4016 |
|
|
{ |
4017 |
|
|
|
4018 |
|
|
|
4019 |
|
|
{ |
4020 |
|
|
|
4021 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4022 |
|
|
|
4023 |
|
|
{ |
4024 |
|
|
|
4025 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#replace-by-itself', 'rdata' => $oldChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1'; |
4026 |
wakaba |
1.1 |
|
4027 |
|
|
|
4028 |
wakaba |
1.3 |
} |
4029 |
wakaba |
1.1 |
|
4030 |
|
|
|
4031 |
|
|
;} |
4032 |
|
|
|
4033 |
|
|
; |
4034 |
|
|
|
4035 |
|
|
|
4036 |
|
|
|
4037 |
wakaba |
1.3 |
} |
4038 |
wakaba |
1.1 |
|
4039 |
|
|
; |
4040 |
|
|
} |
4041 |
|
|
|
4042 |
|
|
my $cns = $self-> |
4043 |
|
|
child_nodes |
4044 |
|
|
; |
4045 |
|
|
my $cnsl = @$cns; |
4046 |
|
|
C: { |
4047 |
|
|
$index = 0; |
4048 |
|
|
for my $i (0..($cnsl-1)) { |
4049 |
|
|
my $cn = $cns->[$i]; |
4050 |
|
|
if ($cn eq $oldChild) { |
4051 |
|
|
$index += $i; |
4052 |
|
|
last C; |
4053 |
|
|
} elsif ($cn eq $newChild) { |
4054 |
|
|
$index = -1; # offset |
4055 |
|
|
} |
4056 |
|
|
} |
4057 |
|
|
|
4058 |
|
|
|
4059 |
|
|
; |
4060 |
|
|
|
4061 |
|
|
|
4062 |
|
|
{ |
4063 |
|
|
|
4064 |
|
|
|
4065 |
|
|
{ |
4066 |
|
|
|
4067 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4068 |
|
|
|
4069 |
|
|
{ |
4070 |
|
|
|
4071 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
4072 |
wakaba |
1.1 |
|
4073 |
|
|
|
4074 |
wakaba |
1.3 |
} |
4075 |
wakaba |
1.1 |
|
4076 |
|
|
|
4077 |
|
|
;} |
4078 |
|
|
|
4079 |
|
|
; |
4080 |
|
|
|
4081 |
|
|
|
4082 |
|
|
|
4083 |
wakaba |
1.3 |
} |
4084 |
wakaba |
1.1 |
|
4085 |
|
|
; |
4086 |
|
|
} # C |
4087 |
|
|
} else { # |oldChild| is not defined |
4088 |
|
|
|
4089 |
|
|
|
4090 |
|
|
{ |
4091 |
|
|
|
4092 |
|
|
|
4093 |
|
|
{ |
4094 |
|
|
|
4095 |
|
|
local $Error::Depth = $Error::Depth - 1; |
4096 |
|
|
|
4097 |
|
|
{ |
4098 |
|
|
|
4099 |
wakaba |
1.15 |
report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; |
4100 |
wakaba |
1.1 |
|
4101 |
|
|
|
4102 |
wakaba |
1.3 |
} |
4103 |
wakaba |
1.1 |
|
4104 |
|
|
|
4105 |
|
|
;} |
4106 |
|
|
|
4107 |
|
|
; |
4108 |
|
|
|
4109 |
|
|
|
4110 |
|
|
|
4111 |
wakaba |
1.3 |
} |
4112 |
wakaba |
1.1 |
|
4113 |
|
|
; |
4114 |
|
|
} |
4115 |
|
|
|
4116 |
|
|
|
4117 |
|
|
|
4118 |
wakaba |
1.3 |
} |
4119 |
wakaba |
1.1 |
|
4120 |
|
|
; # FOR !tc:ForAppendChild |
4121 |
|
|
|
4122 |
|
|
## -- Removes from parent |
4123 |
|
|
if ($nc_parent) { |
4124 |
|
|
if ($child_nt == |
4125 |
wakaba |
1.7 |
11 |
4126 |
wakaba |
1.1 |
) { |
4127 |
wakaba |
1.13 |
$$newChild->{ |
4128 |
|
|
'child' |
4129 |
|
|
} = []; |
4130 |
wakaba |
1.1 |
} else { |
4131 |
wakaba |
1.13 |
my $v = $$nc_parent->{ |
4132 |
|
|
'child' |
4133 |
|
|
}; |
4134 |
wakaba |
1.1 |
RP: for my $i (0..$#$v) { |
4135 |
wakaba |
1.13 |
if ($v->[$i] eq $new_child[0]) { |
4136 |
wakaba |
1.1 |
splice @$v, $i, 1, (); |
4137 |
|
|
last RP; |
4138 |
|
|
} |
4139 |
|
|
} # RP |
4140 |
|
|
} |
4141 |
|
|
} |
4142 |
|
|
|
4143 |
|
|
## -- Rewrite the |parentNode| properties |
4144 |
|
|
for my $nc (@new_child) { |
4145 |
wakaba |
1.13 |
$$nc->{ |
4146 |
|
|
'parent' |
4147 |
|
|
} = $self; |
4148 |
|
|
Scalar::Util::weaken ($$nc->{ |
4149 |
|
|
'parent' |
4150 |
|
|
}); |
4151 |
|
|
} |
4152 |
wakaba |
1.1 |
|
4153 |
wakaba |
1.13 |
my $children = $$self->{ |
4154 |
|
|
'child' |
4155 |
wakaba |
1.1 |
}; |
4156 |
|
|
|
4157 |
|
|
|
4158 |
|
|
|
4159 |
|
|
; |
4160 |
|
|
|
4161 |
|
|
|
4162 |
|
|
|
4163 |
|
|
; |
4164 |
|
|
|
4165 |
|
|
|
4166 |
|
|
|
4167 |
|
|
{ |
4168 |
|
|
|
4169 |
|
|
|
4170 |
|
|
## -- Replaces the node |
4171 |
wakaba |
1.13 |
splice @$children, $index, 1, @new_child; |
4172 |
|
|
CORE::delete $$oldChild->{ |
4173 |
|
|
'parent' |
4174 |
|
|
}; |
4175 |
wakaba |
1.1 |
$r = $oldChild; |
4176 |
|
|
|
4177 |
|
|
|
4178 |
|
|
|
4179 |
wakaba |
1.3 |
} |
4180 |
wakaba |
1.1 |
|
4181 |
|
|
; |
4182 |
|
|
|
4183 |
|
|
|
4184 |
|
|
|
4185 |
wakaba |
1.3 |
} |
4186 |
wakaba |
1.1 |
|
4187 |
|
|
|
4188 |
|
|
;} |
4189 |
|
|
|
4190 |
|
|
; |
4191 |
|
|
|
4192 |
|
|
|
4193 |
wakaba |
1.3 |
} |
4194 |
wakaba |
1.1 |
|
4195 |
|
|
; |
4196 |
|
|
|
4197 |
|
|
|
4198 |
wakaba |
1.3 |
} |
4199 |
wakaba |
1.1 |
$r} |
4200 |
|
|
sub node_name ($;$) { |
4201 |
|
|
if (@_ == 1) {my ($self) = @_; |
4202 |
wakaba |
1.12 |
my $r = ''; |
4203 |
wakaba |
1.1 |
$r = '#document-fragment'; |
4204 |
|
|
$r; |
4205 |
|
|
} else {my ($self) = @_; |
4206 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; |
4207 |
|
|
} |
4208 |
|
|
} |
4209 |
|
|
sub manakai_append_text ($$) { |
4210 |
|
|
my ($self, $string) = @_; |
4211 |
|
|
my $r; |
4212 |
|
|
|
4213 |
|
|
{ |
4214 |
|
|
|
4215 |
|
|
|
4216 |
|
|
{ |
4217 |
|
|
|
4218 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4219 |
|
|
|
4220 |
|
|
{ |
4221 |
|
|
|
4222 |
|
|
|
4223 |
|
|
my |
4224 |
|
|
$lc = $self-> |
4225 |
|
|
last_child |
4226 |
|
|
; |
4227 |
|
|
if (defined $lc and |
4228 |
|
|
$lc-> |
4229 |
|
|
node_type |
4230 |
|
|
== |
4231 |
wakaba |
1.7 |
3 |
4232 |
wakaba |
1.1 |
) { |
4233 |
|
|
$lc-> |
4234 |
|
|
manakai_append_text |
4235 |
|
|
|
4236 |
|
|
(ref $string eq 'SCALAR' ? $string : \$string); |
4237 |
|
|
} else { |
4238 |
|
|
my $text = $self-> |
4239 |
|
|
owner_document |
4240 |
|
|
|
4241 |
|
|
-> |
4242 |
|
|
create_text_node |
4243 |
|
|
|
4244 |
|
|
(ref $string eq 'SCALAR' ? $$string : $string); |
4245 |
|
|
$self-> |
4246 |
|
|
append_child |
4247 |
|
|
($text); |
4248 |
|
|
} |
4249 |
|
|
$r = $self; |
4250 |
|
|
|
4251 |
|
|
|
4252 |
|
|
|
4253 |
wakaba |
1.3 |
} |
4254 |
wakaba |
1.1 |
|
4255 |
|
|
|
4256 |
|
|
;} |
4257 |
|
|
|
4258 |
|
|
; |
4259 |
|
|
|
4260 |
|
|
|
4261 |
wakaba |
1.3 |
} |
4262 |
wakaba |
1.1 |
$r} |
4263 |
|
|
sub get_feature ($$$) { |
4264 |
|
|
my ($self, $feature, $version) = @_; |
4265 |
|
|
|
4266 |
|
|
{ |
4267 |
|
|
|
4268 |
|
|
|
4269 |
|
|
$feature = lc $feature; |
4270 |
|
|
|
4271 |
|
|
|
4272 |
wakaba |
1.3 |
} |
4273 |
wakaba |
1.1 |
|
4274 |
|
|
{ |
4275 |
|
|
|
4276 |
|
|
|
4277 |
|
|
$version = '' unless defined $version; |
4278 |
|
|
|
4279 |
|
|
|
4280 |
wakaba |
1.3 |
} |
4281 |
wakaba |
1.1 |
my $r; |
4282 |
|
|
|
4283 |
|
|
{ |
4284 |
|
|
|
4285 |
|
|
|
4286 |
|
|
$feature =~ s/^\+//; |
4287 |
|
|
|
4288 |
|
|
|
4289 |
|
|
{ |
4290 |
|
|
|
4291 |
|
|
if |
4292 |
wakaba |
1.10 |
($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { |
4293 |
wakaba |
1.1 |
$r = $self; |
4294 |
|
|
} |
4295 |
|
|
|
4296 |
|
|
|
4297 |
wakaba |
1.3 |
} |
4298 |
wakaba |
1.1 |
|
4299 |
|
|
; |
4300 |
|
|
unless (defined $r) { |
4301 |
|
|
|
4302 |
|
|
|
4303 |
|
|
{ |
4304 |
|
|
|
4305 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4306 |
|
|
|
4307 |
|
|
{ |
4308 |
|
|
|
4309 |
|
|
|
4310 |
|
|
|
4311 |
|
|
$r = $self->SUPER::get_feature ($feature, $version); |
4312 |
|
|
|
4313 |
|
|
|
4314 |
|
|
|
4315 |
wakaba |
1.3 |
} |
4316 |
wakaba |
1.1 |
|
4317 |
|
|
|
4318 |
|
|
;} |
4319 |
|
|
|
4320 |
|
|
; |
4321 |
|
|
} |
4322 |
|
|
|
4323 |
|
|
|
4324 |
wakaba |
1.3 |
} |
4325 |
wakaba |
1.1 |
$r} |
4326 |
|
|
sub base_uri ($;$) { |
4327 |
|
|
if (@_ == 1) {my ($self) = @_; |
4328 |
wakaba |
1.12 |
my $r = ''; |
4329 |
wakaba |
1.1 |
|
4330 |
|
|
{ |
4331 |
|
|
|
4332 |
|
|
|
4333 |
|
|
{ |
4334 |
|
|
|
4335 |
|
|
local $Error::Depth = $Error::Depth + 1; |
4336 |
|
|
|
4337 |
|
|
{ |
4338 |
|
|
|
4339 |
|
|
|
4340 |
|
|
|
4341 |
|
|
$r = $self-> |
4342 |
|
|
owner_document |
4343 |
|
|
-> |
4344 |
|
|
base_uri |
4345 |
|
|
; |
4346 |
|
|
|
4347 |
|
|
|
4348 |
|
|
|
4349 |
wakaba |
1.3 |
} |
4350 |
wakaba |
1.1 |
|
4351 |
|
|
|
4352 |
|
|
;} |
4353 |
|
|
|
4354 |
|
|
; |
4355 |
|
|
|
4356 |
|
|
|
4357 |
wakaba |
1.3 |
} |
4358 |
wakaba |
1.1 |
$r; |
4359 |
|
|
} else {my ($self) = @_; |
4360 |
|
|
report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; |
4361 |
|
|
} |
4362 |
|
|
} |
4363 |
|
|
$Message::DOM::DOMFeature::ClassInfo->{q<Message::DOM::Document::ManakaiDOMDocumentFragment>}->{has_feature} = {'core', |
4364 |
|
|
{'', |
4365 |
|
|
'1', |
4366 |
|
|
'1.0', |
4367 |
|
|
'1', |
4368 |
|
|
'2.0', |
4369 |
|
|
'1', |
4370 |
|
|
'3.0', |
4371 |
|
|
'1'}, |
4372 |
|
|
'xml', |
4373 |
|
|
{'', |
4374 |
|
|
'1', |
4375 |
|
|
'1.0', |
4376 |
|
|
'1', |
4377 |
|
|
'2.0', |
4378 |
|
|
'1', |
4379 |
|
|
'3.0', |
4380 |
|
|
'1'}, |
4381 |
|
|
'xmlversion', |
4382 |
|
|
{'', |
4383 |
|
|
'1', |
4384 |
|
|
'1.0', |
4385 |
|
|
'1', |
4386 |
|
|
'1.1', |
4387 |
|
|
'1'}}; |
4388 |
|
|
$Message::DOM::ClassPoint{q<Message::DOM::Document::ManakaiDOMDocumentFragment>} = 14.1; |
4389 |
wakaba |
1.15 |
for ($Message::DOM::IF::Node::){} |
4390 |
wakaba |
1.1 |
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
4391 |
|
|
1; |