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

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -