Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
930 views
in Q2A Core by

I just discovered that today.

In my advanced theme I have the output line:

  $this->output('<meta content="never" name="expires" />');

And checking the HTML source after site load I get:

  <meta content="never" name="expires">


Why is q2a removing the slash in the end?

by
This is weird. either I never noticed or never got this issue. Let me check and back to you.

1 Answer

0 votes
by
selected by
 
Best answer

I found the reason there is a string replacement in function

 

function output_array($elements)
/*
Output each element in $elements on a separate line, with automatic HTML indenting.
This should be passed markup which uses the <tag/> form for unpaired tags, to help keep
track of indenting, although its actual output converts these to <tag> for W3C validation
*/
{
foreach ($elements as $element) {
$delta=substr_count($element, '<')-substr_count($element, '<!')-2*substr_count($element, '</')-substr_count($element, '/>');
 
if ($delta<0)
$this->indent+=$delta;
 
echo str_repeat("\t", max(0, $this->indent)).str_replace('/>', '>', $element)."\n"; // see this here...
 
if ($delta>0)
$this->indent+=$delta;
 
$this->lines++;
}
}
by
Hi pixelngrain, yes I know where the replacement is ;) thx anyway.
My question is *what* is the reason for that... from human perspective / gidgreen's idea behind this.
by
awesome, thank you, this is new for me :)
by
Always welcome :)
...