<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Facelets | LogikDevelopment</title>
	<atom:link href="https://www.logikdev.com/tag/facelets/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.logikdev.com</link>
	<description>&#34;Il n&#039;y a pas de problème, il n&#039;y a que des solutions. L&#039;esprit de l&#039;homme invente ensuite le problème.&#34; André Gide</description>
	<lastBuildDate>Tue, 25 Apr 2017 13:57:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>
	<item>
		<title>Be careful of SKIP_COMMENTS</title>
		<link>https://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/</link>
					<comments>https://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/#respond</comments>
		
		<dc:creator><![CDATA[smoreau]]></dc:creator>
		<pubDate>Tue, 01 Dec 2009 20:25:33 +0000</pubDate>
				<category><![CDATA[Tricks]]></category>
		<category><![CDATA[Facelets]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[old browsers]]></category>
		<category><![CDATA[SKIP_COMMENTS]]></category>
		<guid isPermaLink="false">https://www.logikdev.com/?p=147</guid>

					<description><![CDATA[<p>In the early days, we used to hide JavaScript code from old browsers that do not support JavaScript. The way of doing this was to put a one-line HTML-style comment without the closing characters immediately after the opening &#60;script&#62; tag and put //--&#62; at the end of the script. For example: However if you are [&#8230;]</p>
<p>The post <a href="https://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/">Be careful of SKIP_COMMENTS</a> first appeared on <a href="https://www.logikdev.com">LogikDevelopment</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>In the early days, we used to hide JavaScript code from old browsers that do not support JavaScript.<br />
The way of doing this was to put a one-line HTML-style comment without the closing characters immediately after the opening <code>&lt;script&gt;</code> tag and put <code>//--&gt;</code> at the end of the script.</p>
<p>For example:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
alert('Test');
//--&gt;
&lt;/script&gt;
</pre>
<p>However if you are using this trick with the initialization parameter <code>facelets.SKIP_COMMENTS</code> set to <strong>true</strong>, the code between <code>&lt;!--</code> and <code>//--&gt;</code> won&#8217;t even be sent to the client!<br />
It simply means that the code above won&#8217;t open an alert window because it has been skipped during the page rendering.</p>
<p>Here is what the client will receive:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
//--&gt;
&lt;/script&gt;
</pre>
<p>You have two solutions to avoid this situation:</p>
<ol>
<li>Set the <code>SKIP_COMMENTS</code> parameter to false (the default is true). This can&#8217;t really hurt, your page will just be heavier depending on how much HTML comments you put on your page;</li>
<li>No need to hide the JavaScript code as all browsers are now supporting it and over 99.9% of users have it enabled &#8211; this is the solution I chose.</li>
</ol>
<p>For information, below is the code to put in your web.xml file to set the <code>SKIP_COMMENTS</code> parameter to false:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;context-param&gt;
    &lt;param-name&gt;facelets.SKIP_COMMENTS&lt;/param-name&gt;
    &lt;param-value&gt;false&lt;/param-value&gt;
&lt;/context-param&gt;
</pre><p>The post <a href="https://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/">Be careful of SKIP_COMMENTS</a> first appeared on <a href="https://www.logikdev.com">LogikDevelopment</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
