<?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: Evaluating Script Tags Dynamically</title>
	<atom:link href="http://scriptnode.com/article/evaluating-script-tags-dynamically/feed/" rel="self" type="application/rss+xml" />
	<link>http://scriptnode.com/article/evaluating-script-tags-dynamically/</link>
	<description>Tips and tricks for web developers.</description>
	<lastBuildDate>Sun, 18 Jul 2010 10:29:51 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Matt Hackett</title>
		<link>http://scriptnode.com/article/evaluating-script-tags-dynamically/comment-page-1/#comment-205</link>
		<dc:creator>Matt Hackett</dc:creator>
		<pubDate>Mon, 22 Sep 2008 17:55:45 +0000</pubDate>
		<guid isPermaLink="false">http://scriptnode.com/?p=142#comment-205</guid>
		<description>@Isaac: Licking my chops again! I probably should have read how some libraries do this, but I wanted to do it myself from scratch. Thanks for catching that bug.

@fearphage: Not sure what you mean...</description>
		<content:encoded><![CDATA[<p>@Isaac: Licking my chops again! I probably should have read how some libraries do this, but I wanted to do it myself from scratch. Thanks for catching that bug.</p>
<p>@fearphage: Not sure what you mean&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fearphage</title>
		<link>http://scriptnode.com/article/evaluating-script-tags-dynamically/comment-page-1/#comment-204</link>
		<dc:creator>fearphage</dc:creator>
		<pubDate>Mon, 22 Sep 2008 09:29:39 +0000</pubDate>
		<guid isPermaLink="false">http://scriptnode.com/?p=142#comment-204</guid>
		<description>FYI: If you wrap your script nodes in &lt;![CDATA[ &amp; ]]&gt; tags, you can write &lt;script&gt; and &lt;\/script&gt; all day long</description>
		<content:encoded><![CDATA[<p>FYI: If you wrap your script nodes in &lt;![CDATA[ &amp; ]]&gt; tags, you can write &lt;script&gt; and &lt;\/script&gt; all day long</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fearphage</title>
		<link>http://scriptnode.com/article/evaluating-script-tags-dynamically/comment-page-1/#comment-203</link>
		<dc:creator>fearphage</dc:creator>
		<pubDate>Mon, 22 Sep 2008 09:28:12 +0000</pubDate>
		<guid isPermaLink="false">http://scriptnode.com/?p=142#comment-203</guid>
		<description>FYI: If you wrap your script nodes in  tags, you can write  and  all day long</description>
		<content:encoded><![CDATA[<p>FYI: If you wrap your script nodes in  tags, you can write  and  all day long</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isaac Z. Schlueter</title>
		<link>http://scriptnode.com/article/evaluating-script-tags-dynamically/comment-page-1/#comment-198</link>
		<dc:creator>Isaac Z. Schlueter</dc:creator>
		<pubDate>Sun, 21 Sep 2008 17:52:31 +0000</pubDate>
		<guid isPermaLink="false">http://scriptnode.com/?p=142#comment-198</guid>
		<description>Whoops, it borked the script sample in the comment.

Here you go: http://foohack.com/tests/evalhtml.js</description>
		<content:encoded><![CDATA[<p>Whoops, it borked the script sample in the comment.</p>
<p>Here you go: <a href="http://foohack.com/tests/evalhtml.js" rel="nofollow">http://foohack.com/tests/evalhtml.js</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isaac Z. Schlueter</title>
		<link>http://scriptnode.com/article/evaluating-script-tags-dynamically/comment-page-1/#comment-197</link>
		<dc:creator>Isaac Z. Schlueter</dc:creator>
		<pubDate>Sun, 21 Sep 2008 17:50:34 +0000</pubDate>
		<guid isPermaLink="false">http://scriptnode.com/?p=142#comment-197</guid>
		<description>This bit: ([^&lt;]*) will fall down on stuff like this:

if (3 &lt; 2) alert(&quot;number line fail!&quot;);

To get around that, you can use a chomping algorithm that cuts off just the bits you need, and evals them as you go.

&lt;code&gt;

var evalHTML = function (content) {
  alert(&quot;YOURE DOING IT WRONG!!&quot;);
  var split = content.split(/&lt;script/);
  split.shift(); // throw away anything before the first script tag
  for ( var i = 0, l = split.length; i ...&lt;/script&gt;...&#039;
    piece = piece.split(/&gt;/);
    piece.shift(); // throw it away the &#039;type=&quot;text/javascript&quot;&#039;
    var ex;
    try {
      eval(piece.join(&#039;&gt;&#039;).split(&#039;&lt;/script&gt;&#039;).shift());
    } catch (ex) {}
  }
  return &quot;I hope you&#039;re ashamed of yourself.&quot;;
};
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>This bit: ([^&lt;]*) will fall down on stuff like this:</p>
<p>if (3 &lt; 2) alert(&#8221;number line fail!&#8221;);</p>
<p>To get around that, you can use a chomping algorithm that cuts off just the bits you need, and evals them as you go.</p>
<p><code></p>
<p>var evalHTML = function (content) {<br />
  alert("YOURE DOING IT WRONG!!");<br />
  var split = content.split(/&lt;script/);<br />
  split.shift(); // throw away anything before the first script tag<br />
  for ( var i = 0, l = split.length; i ...&lt;/script&gt;...'<br />
    piece = piece.split(/&gt;/);<br />
    piece.shift(); // throw it away the 'type="text/javascript"'<br />
    var ex;<br />
    try {<br />
      eval(piece.join('&gt;').split('&lt;/script&gt;').shift());<br />
    } catch (ex) {}<br />
  }<br />
  return "I hope you're ashamed of yourself.";<br />
};<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
