Closed almare closed 8 years ago
Just in case you are still experiencing in this issue:
$divnodes = $xpath->query('//div|//p|//nav|//footer|//article|//script|//hr|//br|//ul|//li');
if($c->nodeType==3){ $skip = ["a","b","i","span","strong","strike","em", "small", "sub", "sup", "ins", "del", "mark"]; if($c->previousSibling != null && in_array(strtolower($c->previousSibling->nodeName), $skip) == false) { $c->nodeValue = ltrim($c->nodeValue); } if($c->nextSibling != null && in_array(strtolower($c->nextSibling->nodeName), $skip) == false) { $c->nodeValue = rtrim($c->nodeValue); } }
Thx a lot!! This works great and should be committed
In my code I used the tag in a
container. The result is now that the required whitespaces before and after the tag are removed. Maybe we can add some excluded tags that will not be optimized?