advanced_html_dom
advanced_html_dom copied to clipboard
text() can output extra line breaks
This code
$html = str_get_html('<html><table><tr><td>1
<td>2<tr><td>3<td></body></html>');
var_dump($html->find('tr',0)->text());
on advanced_html_dom.php 0.0.11 outputs
string(4) "1
2"
whereas for compatibility with simple_html_dom.php (e.g. 1.5 ($Rev: 196 $)) it should output:
string(4) "1 2"
Yeah, that's a side effect of DomDocument, if you want you can use clean_text method:
$html->find('tr',0)->clean_text
and that will squeeze all spaces and trim it.
Thanks for the workaround.