@@ 564-578 (lines=15) @@ | ||
561 | $this->node = $newNode; |
|
562 | ||
563 | // Remove head element, preserving child nodes. (again) |
|
564 | if ($newDocument->getIsDOMDocumentCreatedWithoutHeadWrapper() === true) { |
|
565 | $html = $this->node->parentNode->getElementsByTagName('head')[0]; |
|
566 | if ($this->node->parentNode->ownerDocument !== null) { |
|
567 | $fragment = $this->node->parentNode->ownerDocument->createDocumentFragment(); |
|
568 | if ($html !== null) { |
|
569 | /** @var DOMNode $html */ |
|
570 | while ($html->childNodes->length > 0) { |
|
571 | /** @noinspection UnusedFunctionResultInspection */ |
|
572 | $fragment->appendChild($html->childNodes->item(0)); |
|
573 | } |
|
574 | /** @noinspection UnusedFunctionResultInspection */ |
|
575 | $html->parentNode->replaceChild($fragment, $html); |
|
576 | } |
|
577 | } |
|
578 | } |
|
579 | ||
580 | return $this; |
|
581 | } |
|
@@ 681-699 (lines=19) @@ | ||
678 | } |
|
679 | ||
680 | // Remove head element, preserving child nodes. |
|
681 | if ( |
|
682 | $removeExtraHeadTag === true |
|
683 | && |
|
684 | $newDocument->getIsDOMDocumentCreatedWithoutHeadWrapper() === true |
|
685 | ) { |
|
686 | $html = $this->node->parentNode->getElementsByTagName('head')[0]; |
|
687 | if ($this->node->parentNode->ownerDocument !== null) { |
|
688 | $fragment = $this->node->parentNode->ownerDocument->createDocumentFragment(); |
|
689 | if ($html !== null) { |
|
690 | /** @var DOMNode $html */ |
|
691 | while ($html->childNodes->length > 0) { |
|
692 | /** @noinspection UnusedFunctionResultInspection */ |
|
693 | $fragment->appendChild($html->childNodes->item(0)); |
|
694 | } |
|
695 | /** @noinspection UnusedFunctionResultInspection */ |
|
696 | $html->parentNode->replaceChild($fragment, $html); |
|
697 | } |
|
698 | } |
|
699 | } |
|
700 | ||
701 | return $newDocument; |
|
702 | } |