Reputation: 3659
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?
Upvotes: 3
Views: 2011
Reputation: 288530
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.
Upvotes: 4