<?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>Kid666 Blog &#187; JavaScript</title>
	<atom:link href="http://kid666.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://kid666.com</link>
	<description></description>
	<lastBuildDate>Tue, 31 Aug 2010 03:52:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>YUI Event Lister now a Firebug extension</title>
		<link>http://kid666.com/2008/01/06/yui-event-lister-now-a-firebug-extension/</link>
		<comments>http://kid666.com/2008/01/06/yui-event-lister-now-a-firebug-extension/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 17:23:15 +0000</pubDate>
		<dc:creator>sh1mmer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://kid666.com/blog/2008/01/06/yui-event-lister-now-a-firebug-extension/</guid>
		<description><![CDATA[The bookmarklet I made to list out the YUI events on a page is now available as a Firebug extension. You can install the extension from the event lister page. Please be aware however that auto-updating is not yet implemented, so if you want to keep up with changes to the extension you&#8217;ll have to [...]]]></description>
			<content:encoded><![CDATA[<p>The bookmarklet I made to list out the <a href="http://developer.yahoo.com/yui/event/">YUI events</a> on a page is now available as a <a href="">Firebug</a> extension. You can install the extension from the <a href="http://kid666.com/blog/yui-event-list-bookmarklet/">event lister page</a>.</p>
<p>Please be aware however that auto-updating is not yet implemented, so if you want to keep up with changes to the extension you&#8217;ll have to subscribe to the blog, or keep an eye on that page until it is. Once I have auto-updating sorted I&#8217;ll put the extension on <a href="http://addons.mozilla.org">http://addons.mozilla.org</a>.</p>
<p>I want to thank <a href="http://stevesouders.com/">Steve Souders</a> for his work on <a href="http://developer.yahoo.com/yslow/">YSlow</a>. His documentation in the YSlow code was one of the major things that helped me get this project as far as it is. I hope to help continue improving the rather abysmal state of Firebug documentation so other people can create more extensions to what is one of my favourite web development tools.</p>
<p><!-- Technorati Tags Start --></p>
<p>Technorati Tags:<br />
<a href="http://technorati.com/tag/yui" rel="tag">yui</a>, <a href="http://technorati.com/tag/yui%20event%20lister" rel="tag">yui event lister</a>, <a href="http://technorati.com/tag/firebug" rel="tag">firebug</a>, <a href="http://technorati.com/tag/yahoo" rel="tag">yahoo</a>, <a href="http://technorati.com/tag/web%20development" rel="tag">web development</a>, <a href="http://technorati.com/tag/debug" rel="tag">debug</a>, <a href="http://technorati.com/tag/yslow" rel="tag">yslow</a>, <a href="http://technorati.com/tag/steve%20souders" rel="tag">steve souders</a>, <a href="http://technorati.com/tag/firefox" rel="tag">firefox</a>, <a href="http://technorati.com/tag/mozilla" rel="tag">mozilla</a>, <a href="http://technorati.com/tag/javascript" rel="tag">javascript</a>, <a href="http://technorati.com/tag/events" rel="tag">events</a>, <a href="http://technorati.com/tag/bookmarklet" rel="tag">bookmarklet</a>
</p>
<p><!-- Technorati Tags End --></p>
]]></content:encoded>
			<wfw:commentRss>http://kid666.com/2008/01/06/yui-event-lister-now-a-firebug-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Which YUI Event Listener?</title>
		<link>http://kid666.com/2007/08/28/which-yui-event-listener/</link>
		<comments>http://kid666.com/2007/08/28/which-yui-event-listener/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 18:28:52 +0000</pubDate>
		<dc:creator>sh1mmer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://kid666.com/blog/2007/08/28/which-yui-event-listener/</guid>
		<description><![CDATA[The Accessibility toolbar for Firefox has a feature for developers that presents a list of the event handler attributes for each element on the page. The problem is that using attributes to set events is nasty and the YUI Event library instead attaches a singleton listener to the window which isn&#8217;t shown. This main YUI [...]]]></description>
			<content:encoded><![CDATA[<p>The Accessibility toolbar for Firefox has a feature for developers that presents a list of the event handler attributes for each element on the page. The problem is that using attributes to set events is nasty and the <abbr title="Yahoo User Interface">YUI</abbr> Event library instead attaches a <a href="http://en.wikipedia.org/wiki/Singleton_pattern">singleton</a> listener to the window which isn&#8217;t shown. This main YUI listener then delegates to YUI Event listeners which are created.</p>
<p>In order to get something like the functionality in the accessibility toolbar for YUI Event library listeners I&#8217;ve made a bookmarklet that uses some of the functionality of the YUI Event library. The <a href="http://kid666.com/blog/yui-event-list-bookmarklet/">YUI Event List Bookmarklet</a> will show you a list of all the elements on the page that have listeners attached and what those listeners are. You can also view the functions that will be called when the event fires. It&#8217;s perfect for tracking down that elusive listener that&#8217;s using event propagation to hook onto stuff.</p>
<p><!-- Technorati Tags Start --></p>
<p>Technorati Tags:<br />
<a href="http://technorati.com/tag/yui" rel="tag">yui</a>, <a href="http://technorati.com/tag/javascript" rel="tag">javascript</a>, <a href="http://technorati.com/tag/yahoo" rel="tag">yahoo</a>, <a href="http://technorati.com/tag/web%20development" rel="tag">web development</a>, <a href="http://technorati.com/tag/event%20listener" rel="tag">event listener</a>
</p>
<p><!-- Technorati Tags End --></p>
]]></content:encoded>
			<wfw:commentRss>http://kid666.com/2007/08/28/which-yui-event-listener/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>AHAH vs. AJAX. ROUND 1. FIGHT!</title>
		<link>http://kid666.com/2007/01/26/ahah-vs-ajax-round-1-fight/</link>
		<comments>http://kid666.com/2007/01/26/ahah-vs-ajax-round-1-fight/#comments</comments>
		<pubDate>Fri, 26 Jan 2007 19:56:07 +0000</pubDate>
		<dc:creator>sh1mmer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.kid666.com/blog/2007/01/26/ahah-vs-ajax-round-1-fight/</guid>
		<description><![CDATA[AJAX and AHAH are two of the corner stones of the technology for &#8220;Web 2.0&#8243;. While most implementations of AHAH are done using AJAX to make them more robust I see them as two differing models. In essence AHAH requires the minimum of client side processing whereas AJAX uses the client for processing as well [...]]]></description>
			<content:encoded><![CDATA[<p><abbr title="Asynchronous Javascript And XML">AJAX</abbr> and <abbr title="Asynchronous HTML Across HTTP">AHAH</abbr> are two of the corner stones of the technology for &#8220;Web 2.0&#8243;. While most implementations of <abbr title="Asynchronous HTML Across HTTP">AHAH</abbr> are done using <abbr title="Asynchronous Javascript And XML">AJAX</abbr> to make them more robust I see them as two differing models. In essence <abbr title="Asynchronous HTML Across HTTP">AHAH</abbr> requires the minimum of client side processing whereas <abbr title="Asynchronous Javascript And XML">AJAX</abbr> uses the client for processing as well as rendering.</p>
<p>The reason I find this interesting is because of a conversation we had a <a href="http://uk.yahoo.com">my work</a> about how to optimise some <abbr title="Asynchronous Javascript And XML">AJAX</abbr> by using either an <abbr title="eXtensible Markup Language">XML</abbr> data source or a <abbr title="JavaScript Object Notation">JSON</abbr> one. The discussion about the best way to deal with parse trees in the browser made me wonder if most of the &#8220;Web 2.0&#8243; site really need it at all.  </p>
<p>The implementation of <abbr title="Asynchronous HTML Across HTTP">AHAH</abbr> I like is one which wraps some <abbr title="HyperText Markup Language">HTML</abbr> in a <abbr title="JavaScript Object Notation">JSON</abbr> object along with a status code. The application then requests data to render, using the status code to define how it renders it, either as a valid return or as an error. This minimal logic approach avoids the parsing and speed issues on the client, and instead makes the optimisation barrier the HTTP request and the server response time.</p>
<p>I would say that in all but the most hyper-functional of applications the amount of interaction a user does, with the amount of data the server can return in a given request means that this option is most preferable. Really only the spreadsheet, datagrid, etc type application can anticipate the data the user will need next and in volumes to justify using <abbr title="Asynchronous Javascript And XML">AJAX</abbr> in it&#8217;s purest form.</p>
<p><!-- Technorati Tags Start --></p>
<p>Technorati Tags:<br />
<a href="http://technorati.com/tag/AJAX" rel="tag">AJAX</a>, <a href="http://technorati.com/tag/JSON" rel="tag">JSON</a>, <a href="http://technorati.com/tag/Javascript" rel="tag">Javascript</a>, <a href="http://technorati.com/tag/AHAH" rel="tag">AHAH</a>
</p>
<p><!-- Technorati Tags End --></p>
]]></content:encoded>
			<wfw:commentRss>http://kid666.com/2007/01/26/ahah-vs-ajax-round-1-fight/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fortune cookie says: While dog leaps in air, geeks hack Google domains</title>
		<link>http://kid666.com/2007/01/14/fortune-cookie-says-while-dog-leaps-in-air-geeks-hack-google-domains/</link>
		<comments>http://kid666.com/2007/01/14/fortune-cookie-says-while-dog-leaps-in-air-geeks-hack-google-domains/#comments</comments>
		<pubDate>Sun, 14 Jan 2007 23:38:32 +0000</pubDate>
		<dc:creator>sh1mmer</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.kid666.com/blog/2007/01/14/fortune-cookie-says-while-dog-leaps-in-air-geeks-hack-google-domains/</guid>
		<description><![CDATA[Simon Willison linking to a post about Google&#8217;s Latest Security Hole got me thinking. According to the article Google allowed someone to gain control of pages on a sub-domain of google.com. Aside from the obvious dumbness of allowing that to happen (surprising given the usual calibre of their people) it raises an interesting point about [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://simonwillison.net/2007/Jan/14/google/">Simon Willison</a> linking to a post about <a href="http://blog.outer-court.com/archive/2007-01-14-n21.html">Google&#8217;s Latest Security Hole</a> got me thinking.</p>
<p>According to the article Google allowed someone to gain control of pages on a sub-domain of google.com. Aside from the obvious dumbness of allowing that to happen (surprising given the usual calibre of their people) it raises an interesting point about cookies. Tony Ruscoe was able to gain control of another Google user&#8217;s account by having the victim visit the compromised ghs.l.google.com page and reading all his Google cookies with Javascript. He then used the victim&#8217;s cookies as the authentication tokens he needed to access the victim&#8217;s account himself.</p>
<p>This implies to me that we, as web developers, make some assumptions about trust with the user agent. We assume any user agent with the correct authentication tokens is trustworthy. However, this is obviously not the case. My thought is that when we issue tokens we should look at other factors which isolate one computer from another. The obvious one would be location.</p>
<p>For example, when an HTTP request comes in, we need to know where it came from in order to send a reply. Since we know the IP address of the originating computer (or at least it&#8217;s primary upstream NAT address) then why not look all session based authentication to that? In the example above this would have caused the authentication tokens to have failed from the compromised browser because the token was being used from an invalid location. This assumes that your authentication tokens are encrypted to stop tampering, but I would really hope they are anyway.</p>
<p>It wouldn&#8217;t be 100% fool proof (what is?), but it would reduce the attack vectors considerably. To compromise a user, the attacker would have be attempting to use the cookies from the same computer (if they can do that, they could probably steal the cookies straight off the hard drive), from the same NAT (not much to do about this case), or have a compromised router some place. If they did have a router upstream from either Google or the victim they could capture the cookies on-route anyway in a regular request. One simple thing would reduce a lot of issues.</p>
<p>Would this cause any problems with users? I don&#8217;t think so. The changes associated with an IP address tend to be physical anyway, a different computer, a changed wireless lan connection, etc. In this context it actually makes sense to a user to re-authenticate when they move. The physical aspect is important to help users understand the reason why they are having to authenticate a new access token.</p>
<p><!-- Technorati Tags Start --></p>
<p>Technorati Tags:<br />
<a href="http://technorati.com/tag/Security" rel="tag">Security</a>, <a href="http://technorati.com/tag/Javascript" rel="tag">Javascript</a>, <a href="http://technorati.com/tag/cookies" rel="tag">cookies</a>, <a href="http://technorati.com/tag/google" rel="tag">google</a>
</p>
<p><!-- Technorati Tags End --></p>
]]></content:encoded>
			<wfw:commentRss>http://kid666.com/2007/01/14/fortune-cookie-says-while-dog-leaps-in-air-geeks-hack-google-domains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security; AJAX; JSON; Satisfaction</title>
		<link>http://kid666.com/2006/12/23/security-ajax-json-satisfaction/</link>
		<comments>http://kid666.com/2006/12/23/security-ajax-json-satisfaction/#comments</comments>
		<pubDate>Sat, 23 Dec 2006 23:44:23 +0000</pubDate>
		<dc:creator>sh1mmer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.kid666.com/blog/2006/12/23/security-ajax-json-satisfaction/</guid>
		<description><![CDATA[Well, for a while I've been trying to prove that either it is, or isn't, possible to XSS a JSON return which is wrapped in { }. While it is well known that it is possible to exploit the return of a JavaScript array, I've been trying to establish if it is also possible with [...]]]></description>
			<content:encoded><![CDATA[<p>Well, for a while I've been trying to prove that either it is, or isn't, possible to <abbr title="cross site script">XSS</abbr> a <abbr title="JSON">JSON</abbr> return which is wrapped in { }.</p>
<p>While it is well known that it is possible to <a href="http://www.webappsec.org/lists/websecurity/archive/2006-01/msg00087.html">exploit the return of a JavaScript array</a>, I've been trying to establish if it is also possible with generic objects conforming to the <a href="http://json.org">JSON standard</a>.</p>
<div class="igBar"><span id="ljavascript-2"><a href="#" onclick="javascript:showPlainTxt('javascript-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-2">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #3366CC;">"glossary"</span>: <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"title"</span>: <span style="color: #3366CC;">"example glossary"</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"GlossDiv"</span>: <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"title"</span>: <span style="color: #3366CC;">"S"</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"GlossList"</span>: <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"GlossEntry"</span>: <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"ID"</span>: <span style="color: #3366CC;">"SGML"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"SortAs"</span>: <span style="color: #3366CC;">"SGML"</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"GlossTerm"</span>: <span style="color: #3366CC;">"Standard Generalized Markup Language"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"Acronym"</span>: <span style="color: #3366CC;">"SGML"</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"Abbrev"</span>: <span style="color: #3366CC;">"ISO 8879:1986"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"GlossDef"</span>: <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"para"</span>: <span style="color: #3366CC;">"A meta-markup language, used to create markup languages such as DocBook."</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"GlossSeeAlso"</span>: <span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">"GML"</span>, <span style="color: #3366CC;">"XML"</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">"GlossSee"</span>: <span style="color: #3366CC;">"markup"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This is the example JSON provided by <a href="http://www.json.org/example.html">json.org</a>. If you encapsulate this directly in &lt;script&gt; tags then browsers will throw an error.</p>
<p>I have tried to overwrite the object constructor in all the major browsers. None of <a href="http://developer.yahoo.com/yui/articles/gbs/gbs_browser-chart.html">Yahoo's A-grade browsers</a> will call the constructor for these object returns, because of the object exception.</p>
<p>I have come to the conclusion that browsers parse { } because as a script block not an object, but will <em>not</em> parse an actual object without a label. <a href="http://nefariousdesigns.co.uk/">Tim</a> and I were talking about this and agreed that the parser allows [] without a label for the construction of anonymous arrays to make multi-dimensional arrays. Good thinking Batman Tim!</p>
<p>What does all this mean? In effect that means that using a JSON return in as per the example wrapped in { } means it can't be used for XSS. Using a simple array return is still as vulnerable as ever.</p>
<p><!-- Technorati Tags Start --></p>
<p>Technorati Tags:<br />
<a href="http://technorati.com/tag/AJAX" rel="tag">AJAX</a>, <a href="http://technorati.com/tag/JSON" rel="tag">JSON</a>, <a href="http://technorati.com/tag/Security" rel="tag">Security</a>, <a href="http://technorati.com/tag/Javascript" rel="tag">Javascript</a>
</p>
<p><!-- Technorati Tags End --></p>
]]></content:encoded>
			<wfw:commentRss>http://kid666.com/2006/12/23/security-ajax-json-satisfaction/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Quick tip; firefox javascript debugging</title>
		<link>http://kid666.com/2006/12/19/quick-tip-firefox-javascript-debugging/</link>
		<comments>http://kid666.com/2006/12/19/quick-tip-firefox-javascript-debugging/#comments</comments>
		<pubDate>Tue, 19 Dec 2006 17:02:33 +0000</pubDate>
		<dc:creator>sh1mmer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.kid666.com/blog/?p=49</guid>
		<description><![CDATA[While I totally advocate using]]></description>
			<content:encoded><![CDATA[<p><strike>While I totally advocate using <a href=http://www.getfirebug.com/">Firebug</a> sometimes you need a starting point. I've been doing a few things that use prevent default to repress page loads. However, if something fails before the prevent default then it's difficult to debug because the console is cleared when the page reloads. In order to stop this and to give me a starting point for places to put break points I've been using <a href="https://addons.mozilla.org/firefox/966/">Tamper Data</a> to abort page requests.</strike></p>
<p>Whoops! I don't do Firebug enough credit. Just click on the 'script' tab and select 'Break on all errors' in the options menu. Now it breaks on any and all errors. Sweet.</p>
<p><img src="http://www.kid666.com/blog/wp-content/uploads/2006/12//firebugdebug.png" border="0" height="195" width="494" alt="" align="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://kid666.com/2006/12/19/quick-tip-firefox-javascript-debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic merging and versioning of CSS/JS files with PHP</title>
		<link>http://kid666.com/2006/12/14/automatic-merging-and-versioning-of-cssjs-files-with-php/</link>
		<comments>http://kid666.com/2006/12/14/automatic-merging-and-versioning-of-cssjs-files-with-php/#comments</comments>
		<pubDate>Thu, 14 Dec 2006 16:05:26 +0000</pubDate>
		<dc:creator>sh1mmer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.kid666.com/blog/?p=45</guid>
		<description><![CDATA[Ed at work has written a really awesome post on using PHP to version JavaScript and CSS files into a single versioned include. His post Automatic merging and versioning of CSS/JS files with PHP make this all really trivial. Nice one Ed!]]></description>
			<content:encoded><![CDATA[<p>Ed at <a href="http://uk.yahoo.com">work</a> has written a really awesome post on using PHP to version JavaScript and CSS files into a single versioned include. His post <a href="http://www.ejeliot.com/blog/72">Automatic merging and versioning of CSS/JS files with PHP</a> make this all really trivial. Nice one Ed!</p>
]]></content:encoded>
			<wfw:commentRss>http://kid666.com/2006/12/14/automatic-merging-and-versioning-of-cssjs-files-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loving the DOM; insert child nodes at any position</title>
		<link>http://kid666.com/2006/12/11/loving-the-dom/</link>
		<comments>http://kid666.com/2006/12/11/loving-the-dom/#comments</comments>
		<pubDate>Mon, 11 Dec 2006 22:37:54 +0000</pubDate>
		<dc:creator>sh1mmer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.kid666.com/blog/?p=41</guid>
		<description><![CDATA[One day I was bitching about the lack of a way to insert something at an arbitrary point into a list of DOM nodes. "I don't want to walk the DOM, or walk with Dinosaurs, for that matter!" said I, or something equally witty. <a href="http://www.dynamicflash.com/">Steve Webster</a> sick of my whining, no doubt, suggested I write one.

So I did (with a little help from <a href="http://www.wait-till-i.com/">Heilmann</a>).

<p>Below the fold in all it's glory</p>]]></description>
			<content:encoded><![CDATA[<p>One day I was bitching about the lack of a way to insert something at an arbitrary point into a list of DOM nodes. "I don't want to walk the DOM, or walk with Dinosaurs, for that matter!" said I, or something equally witty. <a href="http://www.dynamicflash.com/">Steve Webster</a> sick of my whining, no doubt, suggested I write one.</p>
<p>So I did (with a little help from <a href="http://www.wait-till-i.com/">Heilmann</a>).</p>
<p>Here it is in all it's glory</p>
<div class="igBar"><span id="ljavascript-3"><a href="#" onclick="javascript:showPlainTxt('javascript-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-3">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">insertAtPosition = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>root, el, pos<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #009900; font-style: italic;">//remove any whitespace nodes</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i=<span style="color: #CC0000;color:#800000;">0</span>,j=root.<span style="color: #006600;">childNodes</span>.<span style="color: #006600;">length</span>;i&amp;lt;j ;i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>x.<span style="color: #006600;">childNodes</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>===undefined<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #000066; font-weight: bold;">break</span>;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>x.<span style="color: #006600;">childNodes</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">nodeType</span>===<span style="color: #CC0000;color:#800000;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; x.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>x.<span style="color: #006600;">childNodes</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; i--;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #009900; font-style: italic;">//if the position is out of the current scope of the element</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>pos&gt;root.<span style="color: #006600;">childNodes</span>.<span style="color: #006600;">length</span> || pos&amp;lt;<span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #009900; font-style: italic;">// if pos is the same as length then add to the end of the children array</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>pos===root.<span style="color: #006600;">childNodes</span>.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;root.<span style="color: #006600;">appendChild</span><span style="color: #66cc66;">&#40;</span>el<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #009900; font-style: italic;">// insert before works for all other cases</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;root.<span style="color: #006600;">insertBefore</span><span style="color: #66cc66;">&#40;</span>el, root.<span style="color: #006600;">childNodes</span><span style="color: #66cc66;">&#91;</span>pos<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://kid666.com/2006/12/11/loving-the-dom/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

