Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

why do the commented code also work?

I'm just surprised today, while testing my site I found something interesting on chrome browser:

<jdoc:include type="head" /> which results joomla features links and meta, etc like this:

<base href="" />
    <meta />
    ......

But even after commenting the code like this:

<!---<jdoc:include type="head" />--->

Results while inspecting:

<!---
<base href="" />
<meta />
......

--->

Why is this not showing just <!---<jdoc:include type="head" />--->


Please note: <jdoc:include type="head" /> is joomla framework feature...

Upvotes: 0

Views: 64

Answers (1)

Kaamil Jasani
Kaamil Jasani

Reputation: 464

<jdoc... /> is processed on the server side (on Joomla's servers). This means that it will ignore the comment marks and process everything that makes sense to it because HTML comment marks are processed on the client side, not the server side. After it has been processed by the server, it sends the processed info with the comment marks to the client side and then the client side filters it out as a comment. This is why you are getting all the new code like <base href="" /> when it is a comment.

Hope I helped!

Upvotes: 1

Related Questions