protected function unwrap(DOMElement $embed)
    {
        $link = $embed->parentNode;
        $childCount = 0;

        /** @var \DOMText|\DOMElement $node */
        foreach ($link->childNodes as $node) {
            if (!($node->nodeType === XML_TEXT_NODE && $node->isWhitespaceInElementContent())) {
                ++$childCount;
            }
        }

        if ($childCount === 1) {
            $link->parentNode->replaceChild($embed, $link);
        }
    }