My code looks like that
<?php
ob_start();
?>
....
Some HTML
...
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
<strong>Alert:</strong> Sample ui-state-error style.</p>
</div>
....
Some HTML
...
<?php
$markup = ob_get_clean();
// Specify configuration
$config = array(
'indent' => true,
'output-xhtml' => true,
'wrap' => 200);
// Tidy
$tidy = new tidy;
$tidy->parseString($markup, $config, 'utf8');
$tidy->cleanRepair();
// Output
echo $tidy;
?>
Getting result without <span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>. What am I missing? Maybe TIDY class removing empty tags? If yes, How can I prevent it?
I posted a comment: "Have you tried adding or some text inside the span to be sure that is removed because it's empty?". And it seems that worked.
So if somebody has the same problem and comes here, the solution is:
Add inside the empty element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With