<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>Comments on: A JavaScript Trick You Should Know</title>
	<atom:link href="/2011/07/12/a-javascript-trick-you-should-know/feed/" rel="self" type="application/rss+xml" />
	<link>/2011/07/12/a-javascript-trick-you-should-know/</link>
	<description>on web development</description>
	<lastBuildDate>Fri, 26 Oct 2018 21:40:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>By: Danilo</title>
		<link>/2011/07/12/a-javascript-trick-you-should-know/comment-page-1/#comment-14383</link>
		<dc:creator><![CDATA[Danilo]]></dc:creator>
		<pubDate>Fri, 29 Jul 2011 16:17:23 +0000</pubDate>
		<guid isPermaLink="false">/?p=2333#comment-14383</guid>
		<description><![CDATA[How can I concat variables with that string?]]></description>
		<content:encoded><![CDATA[<p>How can I concat variables with that string?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TimTheTinker</title>
		<link>/2011/07/12/a-javascript-trick-you-should-know/comment-page-1/#comment-14363</link>
		<dc:creator><![CDATA[TimTheTinker]]></dc:creator>
		<pubDate>Tue, 12 Jul 2011 21:00:34 +0000</pubDate>
		<guid isPermaLink="false">/?p=2333#comment-14363</guid>
		<description><![CDATA[Darn, it killed my script tag. Trying again using square brackets instead of angle brackets:
&lt;pre lang=&quot;javascript&quot;&gt;
[script type=&quot;appresources/string&quot; id=&quot;example]
Hello
I’m a
Really
Multiline
String
[/script]
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Darn, it killed my script tag. Trying again using square brackets instead of angle brackets:</p>
<pre lang="javascript">
[script type="appresources/string" id="example]
Hello
I’m a
Really
Multiline
String
[/script]
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: TimTheTinker</title>
		<link>/2011/07/12/a-javascript-trick-you-should-know/comment-page-1/#comment-14362</link>
		<dc:creator><![CDATA[TimTheTinker]]></dc:creator>
		<pubDate>Tue, 12 Jul 2011 20:58:57 +0000</pubDate>
		<guid isPermaLink="false">/?p=2333#comment-14362</guid>
		<description><![CDATA[Here&#039;s another idea: if you have a large, multi-line string, just put it inside a script tag.

&lt;pre lang=&quot;javascript&quot;&gt;
&lt;script&gt;
Hello
I&#039;m a 
Really
Multiline
String
&lt;/script&gt;
&lt;/pre&gt;

And then you can get it from javascript like this (example is in jQuery):
&lt;pre lang=&quot;javascript&quot;&gt;
var string = $(&#039;#example&#039;).html();
&lt;/pre&gt;
This has the added benefit of locating all your long strings (templates, etc.) in a better place -- the markup!

Roy]]></description>
		<content:encoded><![CDATA[<p>Here&#8217;s another idea: if you have a large, multi-line string, just put it inside a script tag.</p>
<pre lang="javascript">
<script>
Hello
I'm a 
Really
Multiline
String
</script>
</pre>
<p>And then you can get it from javascript like this (example is in jQuery):</p>
<pre lang="javascript">
var string = $('#example').html();
</pre>
<p>This has the added benefit of locating all your long strings (templates, etc.) in a better place &#8212; the markup!</p>
<p>Roy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Duckett</title>
		<link>/2011/07/12/a-javascript-trick-you-should-know/comment-page-1/#comment-14361</link>
		<dc:creator><![CDATA[Robin Duckett]]></dc:creator>
		<pubDate>Tue, 12 Jul 2011 17:04:42 +0000</pubDate>
		<guid isPermaLink="false">/?p=2333#comment-14361</guid>
		<description><![CDATA[Incorrect.

This is using a Firefox only E4X pattern.
Do not teach people this fairly useless technique.

var string = &quot;Hello\n\
I&#039;m a\n\
Really\n\
Multiline\n\
String&quot;;

Try the above.

This will work regardless of browser.
(The &quot;trick&quot; here is the end \ is escaping the new line. Genius).]]></description>
		<content:encoded><![CDATA[<p>Incorrect.</p>
<p>This is using a Firefox only E4X pattern.<br />
Do not teach people this fairly useless technique.</p>
<p>var string = &#8220;Hello\n\<br />
I&#8217;m a\n\<br />
Really\n\<br />
Multiline\n\<br />
String&#8221;;</p>
<p>Try the above.</p>
<p>This will work regardless of browser.<br />
(The &#8220;trick&#8221; here is the end \ is escaping the new line. Genius).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
