symfony - DomCrawler is removing part of the html -


when content without domcrawler, html custom tags @click when use $this->crawler->filter('something')->html() domcrawler removing @click tags.

here example without using domcrawler:

enter image description here

and here using domcrawler:

enter image description here

as can see, domcrawler removing @clicks, how can stop this?

unfortunately, can't. domcrawler uses domdocument under hood , not allow "@click". also:

the domcrawler attempt automatically fix html match official specification.

the modifiers disable libxml_html_noimplied not used in addhmlcontent method of domcrawler:

//... symfony\component\domcrawler\crawler.php $dom->loadhtml($content); // ... 

and calling @$dom->loadhtml($content, libxml_html_noimplied); not work in case.

example:

$html = <<<test    <html>        <div class="test" @click="something"></div>    </html> test;     dump($html);     //<html>\n     //    <div class="test" @click="something"></div>\n     //</html>      // symfony crawler     $crawler = new \symfony\component\domcrawler\crawler();     $crawler->addhtmlcontent($html);     dump($crawler->html());     //<body>\n     //    <div class="test"></div>\n     //</body>      // custom crawler libxml_html_noimplied     $crawler = new \mycrawler\crawler();     $crawler->addhtmlcontent($html);     dump($crawler->html());     //  <div class="test"></div> 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -