@@ 384-397 (lines=14) @@ | ||
381 | return $this->appendChild($child, ...$optionals); |
|
382 | } |
|
383 | ||
384 | public function prependSibling($sibling, ...$optionals) |
|
385 | { |
|
386 | if ($this->dom->documentElement === null) { |
|
387 | // If the document doesn't have at least one root node, |
|
388 | // the sibling creation fails. In this case we replace |
|
389 | // the sibling creation with the creation of a generic node. |
|
390 | return $this->appendChild($sibling, ...$optionals); |
|
391 | } |
|
392 | ||
393 | $context = $this->newContext(); |
|
394 | $new_context = $context->prependSibling($sibling, ...$optionals); |
|
395 | ||
396 | return $this->chooseContext($context, $new_context); |
|
397 | } |
|
398 | ||
399 | // Alias of prependSibling(). |
|
400 | public function prepend($sibling, ...$optionals) |
|
@@ 411-424 (lines=14) @@ | ||
408 | return $this->prependSibling($sibling, ...$optionals); |
|
409 | } |
|
410 | ||
411 | public function appendSibling($sibling, ...$optionals) |
|
412 | { |
|
413 | if ($this->dom->documentElement === null) { |
|
414 | // If the document doesn't have at least one root node, |
|
415 | // the sibling creation fails. In this case we replace |
|
416 | // the sibling creation with the creation of a generic node. |
|
417 | return $this->appendChild($sibling, ...$optionals); |
|
418 | } |
|
419 | ||
420 | $context = $this->newContext(); |
|
421 | $new_context = $context->appendSibling($sibling, ...$optionals); |
|
422 | ||
423 | return $this->chooseContext($context, $new_context); |
|
424 | } |
|
425 | ||
426 | // Alias of appendSibling(). |
|
427 | public function append($sibling, ...$optionals) |