Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Crawler.php

function Crawler::canParseHtml5String

1 call to Crawler::canParseHtml5String()
Crawler::parseHtmlString in vendor/symfony/dom-crawler/Crawler.php
Parse string into DOMDocument object using HTML5 parser if the content is HTML5 and the library is available. Use libxml parser otherwise.

File

vendor/symfony/dom-crawler/Crawler.php, line 1213

Class

Crawler
Crawler eases navigation of a list of \DOMNode objects.

Namespace

Symfony\Component\DomCrawler

Code

private function canParseHtml5String(string $content) : bool {
    if (!$this->html5Parser) {
        return false;
    }
    if (false === ($pos = stripos($content, '<!doctype html>'))) {
        return false;
    }
    $header = substr($content, 0, $pos);
    return '' === $header || $this->isValidHtml5Heading($header);
}
RSS feed
Powered by Drupal