<?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 for magnetiq.com</title>
	<atom:link href="http://magnetiq.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://magnetiq.com</link>
	<description>Ates Goral's Personal Playground and Project Repository</description>
	<lastBuildDate>Wed, 01 Apr 2009 23:28:36 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on JavaScript function definition inside a with() block: Firefox is the oddball by mtl</title>
		<link>http://magnetiq.com/2009/02/14/function-definition-inside-with/comment-page-1/#comment-38801</link>
		<dc:creator>mtl</dc:creator>
		<pubDate>Wed, 01 Apr 2009 23:28:36 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/?p=173#comment-38801</guid>
		<description>I just stumbled on this problem as well.  At the root of the matter is the following: function definitions are not allowed inside &#039;with&#039; statements or &#039;catch&#039; blocks, according to the ECMAScript standard (262, 3rd edition).  I&#039;ll give a bit of detail below in the hopes it can be helpful to someone else.

In the ECMAScript grammar, function declarations are only allowed to occur inside &#039;SourceElement&#039;.  Thus, Chrome, Firefox, IE, Opera and Safari all diverge from the ECMAScript standard with specific regard to section 12.4 (&#039;ExpressionStatement&#039;).  Strictly speaking, the function definition in your &#039;with&#039; statement is invalid syntax and should cause a thrown exception.

The spec doesn&#039;t allow functions to be defined in this way for good reason: the function&#039;s scope could not possibly be known at the time the function object is created.  This leads to all sorts of inconsistencies in how browsers implement this bug.

As you said, Firefox will do the best it can given the circumstances: define function &#039;foo&#039; in the variable/activation object of the enclosing function (or the global object), and add &#039;obj&#039; to the static scope chain used by &#039;foo&#039;.  However, unlike proper function definitions, you will not be able to forward-reference &#039;foo&#039;.  Again, forward references would be problematic because the scope used by &#039;foo&#039; hasn&#039;t been defined yet.

The other browsers you mentioned will simply create the &#039;foo&#039; function as if it were not contained in the &#039;with&#039; statement.  This technique allows forward-referencing &#039;foo&#039;, but as you&#039;ve noticed this completely ignores the use of &#039;with&#039; when invoking &#039;foo&#039;.

Finally, for something really strange you should see what IE does when including a function definition inside of a &#039;catch&#039; block:

&lt;pre&gt;
function x() {

	var ox = {
		vx: 2
	};

	var oxx = {
		vx: 3
	};

	try {

		throw oxx;

	} catch (ox) {
	
		function y () {
			ox.vx = -1;
		}
	};

	y();

	alert(ox.vx);
	alert(oxx.vx);
}

x();
&lt;/pre&gt;

Chrome, Firefox, Opera and Safari use the same approach as for &#039;with&#039;.  However, upon invoking &#039;y&#039;, IE will modify &lt;i&gt;both&lt;/i&gt; &#039;ox.vx&#039; and &#039;oxx.vx&#039; (changing them each to -1).

I&#039;m not sure what is happening in this case, but it goes to show this is one instance where the standard writers got it right and browser implementations didn&#039;t take the advice.</description>
		<content:encoded><![CDATA[<p>I just stumbled on this problem as well.  At the root of the matter is the following: function definitions are not allowed inside &#8216;with&#8217; statements or &#8216;catch&#8217; blocks, according to the ECMAScript standard (262, 3rd edition).  I&#8217;ll give a bit of detail below in the hopes it can be helpful to someone else.</p>
<p>In the ECMAScript grammar, function declarations are only allowed to occur inside &#8216;SourceElement&#8217;.  Thus, Chrome, Firefox, IE, Opera and Safari all diverge from the ECMAScript standard with specific regard to section 12.4 (&#8217;ExpressionStatement&#8217;).  Strictly speaking, the function definition in your &#8216;with&#8217; statement is invalid syntax and should cause a thrown exception.</p>
<p>The spec doesn&#8217;t allow functions to be defined in this way for good reason: the function&#8217;s scope could not possibly be known at the time the function object is created.  This leads to all sorts of inconsistencies in how browsers implement this bug.</p>
<p>As you said, Firefox will do the best it can given the circumstances: define function &#8216;foo&#8217; in the variable/activation object of the enclosing function (or the global object), and add &#8216;obj&#8217; to the static scope chain used by &#8216;foo&#8217;.  However, unlike proper function definitions, you will not be able to forward-reference &#8216;foo&#8217;.  Again, forward references would be problematic because the scope used by &#8216;foo&#8217; hasn&#8217;t been defined yet.</p>
<p>The other browsers you mentioned will simply create the &#8216;foo&#8217; function as if it were not contained in the &#8216;with&#8217; statement.  This technique allows forward-referencing &#8216;foo&#8217;, but as you&#8217;ve noticed this completely ignores the use of &#8216;with&#8217; when invoking &#8216;foo&#8217;.</p>
<p>Finally, for something really strange you should see what IE does when including a function definition inside of a &#8216;catch&#8217; block:</p>
<pre>
function x() {

	var ox = {
		vx: 2
	};

	var oxx = {
		vx: 3
	};

	try {

		throw oxx;

	} catch (ox) {

		function y () {
			ox.vx = -1;
		}
	};

	y();

	alert(ox.vx);
	alert(oxx.vx);
}

x();
</pre>
<p>Chrome, Firefox, Opera and Safari use the same approach as for &#8216;with&#8217;.  However, upon invoking &#8216;y&#8217;, IE will modify <i>both</i> &#8216;ox.vx&#8217; and &#8216;oxx.vx&#8217; (changing them each to -1).</p>
<p>I&#8217;m not sure what is happening in this case, but it goes to show this is one instance where the standard writers got it right and browser implementations didn&#8217;t take the advice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JavaScript function definition inside a with() block: Firefox is the oddball by Ates Goral</title>
		<link>http://magnetiq.com/2009/02/14/function-definition-inside-with/comment-page-1/#comment-38800</link>
		<dc:creator>Ates Goral</dc:creator>
		<pubDate>Wed, 25 Mar 2009 03:15:29 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/?p=173#comment-38800</guid>
		<description>@Olivier: You&#039;re right, it works (returns &quot;number&quot;) on all browsers with the variation that you suggested.

I had actually come across this function definition/expression identity of Firefox that you pointed out, under a different context. You can add a &lt;code&gt;window.onload&lt;/code&gt; handler by simply defining a global function called &quot;onload&quot; on Firefox:

&lt;pre&gt;
function onload() {
    alert(42);
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Olivier: You&#8217;re right, it works (returns &#8220;number&#8221;) on all browsers with the variation that you suggested.</p>
<p>I had actually come across this function definition/expression identity of Firefox that you pointed out, under a different context. You can add a <code>window.onload</code> handler by simply defining a global function called &#8220;onload&#8221; on Firefox:</p>
<pre>
function onload() {
    alert(42);
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on browsersize.com updates by Craig Walker</title>
		<link>http://magnetiq.com/2008/12/22/browsersizecom-updates/comment-page-1/#comment-38799</link>
		<dc:creator>Craig Walker</dc:creator>
		<pubDate>Sat, 14 Mar 2009 18:13:15 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/?p=160#comment-38799</guid>
		<description>Hi Ates. I found browsersize while re-googling this article:

&lt;a href=&quot;http://justaddwater.dk/2006/08/17/design-for-browser-size-not-screen-size/&quot; rel=&quot;nofollow&quot;&gt;Design for Browser Size, Not Screen Size&lt;/a&gt;.

I think your site is great. It prompted some ideas &amp; questions for me:

- Is your browser detection reporting the gross size of the browser window or the net size of the browser content area? (I&#039;m assuming the former since that&#039;s how you describe it, but I wanted to be sure).

- If the former, do you know of a way to detect the browser content area size? That&#039;s the dimension that the web designer should *really* be interested in.

- I see you&#039;re recording the browser stats for the people who visit your site. Getting these metrics is a very good thing as it helps inform designers. Is it possible to get this information from some sort of unintrusive web-bug/google analytics -style object or script? What I&#039;d like to see is the ability to get a wider sampling of browsers from multiple sites. If it&#039;s possible to have a simple drop-in detector, site owners could add it to their site and get size stats on their own visitors. (Obviously, cross-site-scripting concerns would have to be addressed, but Google seems to have found a way).</description>
		<content:encoded><![CDATA[<p>Hi Ates. I found browsersize while re-googling this article:</p>
<p><a href="http://justaddwater.dk/2006/08/17/design-for-browser-size-not-screen-size/" rel="nofollow">Design for Browser Size, Not Screen Size</a>.</p>
<p>I think your site is great. It prompted some ideas &amp; questions for me:</p>
<p>- Is your browser detection reporting the gross size of the browser window or the net size of the browser content area? (I&#8217;m assuming the former since that&#8217;s how you describe it, but I wanted to be sure).</p>
<p>- If the former, do you know of a way to detect the browser content area size? That&#8217;s the dimension that the web designer should *really* be interested in.</p>
<p>- I see you&#8217;re recording the browser stats for the people who visit your site. Getting these metrics is a very good thing as it helps inform designers. Is it possible to get this information from some sort of unintrusive web-bug/google analytics -style object or script? What I&#8217;d like to see is the ability to get a wider sampling of browsers from multiple sites. If it&#8217;s possible to have a simple drop-in detector, site owners could add it to their site and get size stats on their own visitors. (Obviously, cross-site-scripting concerns would have to be addressed, but Google seems to have found a way).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Fewer Images by ifixurpics.com</title>
		<link>http://magnetiq.com/2006/08/27/using-less-images/comment-page-1/#comment-38798</link>
		<dc:creator>ifixurpics.com</dc:creator>
		<pubDate>Fri, 06 Mar 2009 22:02:41 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/2006/08/27/using-less-images/#comment-38798</guid>
		<description>Hey... Thank you so so much for this well explained tut. I am not praogramming litrate... but i feel so encouranged from being able to follow ur explaination... the rollover images have worked well... the method i am using is the single image (images side by side) and yes i have noticed that the loading time has decreased. Thanx a stac for your time and effect. Bless you! :)

www.ifixurpics.com

Neateye</description>
		<content:encoded><![CDATA[<p>Hey&#8230; Thank you so so much for this well explained tut. I am not praogramming litrate&#8230; but i feel so encouranged from being able to follow ur explaination&#8230; the rollover images have worked well&#8230; the method i am using is the single image (images side by side) and yes i have noticed that the loading time has decreased. Thanx a stac for your time and effect. Bless you! :)</p>
<p><a href="http://www.ifixurpics.com" rel="nofollow">http://www.ifixurpics.com</a></p>
<p>Neateye</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JavaScript function definition inside a with() block: Firefox is the oddball by Oliver</title>
		<link>http://magnetiq.com/2009/02/14/function-definition-inside-with/comment-page-1/#comment-38797</link>
		<dc:creator>Oliver</dc:creator>
		<pubDate>Sat, 14 Feb 2009 12:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/?p=173#comment-38797</guid>
		<description>I believe firefox treats all function definitions as equivalent to function expressions, try

&lt;pre&gt;
with(obj) {
    var foo = function() {
        return typeof a;
    }
}
alert(foo())
&lt;/pre&gt;

I suspect you&#039;ll find that they all produce number in that case</description>
		<content:encoded><![CDATA[<p>I believe firefox treats all function definitions as equivalent to function expressions, try</p>
<pre>
with(obj) {
    var foo = function() {
        return typeof a;
    }
}
alert(foo())
</pre>
<p>I suspect you&#8217;ll find that they all produce number in that case</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Fewer Images by rupert</title>
		<link>http://magnetiq.com/2006/08/27/using-less-images/comment-page-1/#comment-38796</link>
		<dc:creator>rupert</dc:creator>
		<pubDate>Thu, 05 Feb 2009 10:18:42 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/2006/08/27/using-less-images/#comment-38796</guid>
		<description>good skills dude! worked a treat. if you had a donation button i&#039;d gladly send you one.
many thanks.</description>
		<content:encoded><![CDATA[<p>good skills dude! worked a treat. if you had a donation button i&#8217;d gladly send you one.<br />
many thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on browsersize.com updates by nologo</title>
		<link>http://magnetiq.com/2008/12/22/browsersizecom-updates/comment-page-1/#comment-38795</link>
		<dc:creator>nologo</dc:creator>
		<pubDate>Tue, 20 Jan 2009 03:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/?p=160#comment-38795</guid>
		<description>YÄ±llardÄ±r whatsmy.browsersize.com adlÄ± siteni kulanÄ±yorum hatÄ±rlamÄ±yorum tam olarak ama epey oldu...

neyse bu gÃ¼ne kadar kim yaptÄ± diye hiÃ§ meraketmedim kimse kim diyordum fakat cidden bir teÅŸekkÃ¼rÃ¼ sana borc bilirim ellerine saÄŸlÄ±k hocam.

iyi Ã§alÄ±ÅŸmalar.</description>
		<content:encoded><![CDATA[<p>YÄ±llardÄ±r whatsmy.browsersize.com adlÄ± siteni kulanÄ±yorum hatÄ±rlamÄ±yorum tam olarak ama epey oldu&#8230;</p>
<p>neyse bu gÃ¼ne kadar kim yaptÄ± diye hiÃ§ meraketmedim kimse kim diyordum fakat cidden bir teÅŸekkÃ¼rÃ¼ sana borc bilirim ellerine saÄŸlÄ±k hocam.</p>
<p>iyi Ã§alÄ±ÅŸmalar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Automatic Table of Contents Generation by brazzmonkey</title>
		<link>http://magnetiq.com/2008/10/19/automatic-table-of-contents-generation/comment-page-1/#comment-38794</link>
		<dc:creator>brazzmonkey</dc:creator>
		<pubDate>Thu, 08 Jan 2009 12:18:14 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/?p=101#comment-38794</guid>
		<description>thank you for this script. one caveat, though: it won&#039;t work for headings having a link between the &quot;h&quot; tags...</description>
		<content:encoded><![CDATA[<p>thank you for this script. one caveat, though: it won&#8217;t work for headings having a link between the &#8220;h&#8221; tags&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on ACB2XML 2.0b &#8211; Export Adobe Color Book Data as XML by Ariel Demi</title>
		<link>http://magnetiq.com/2007/05/08/acb2xml/comment-page-1/#comment-38792</link>
		<dc:creator>Ariel Demi</dc:creator>
		<pubDate>Mon, 24 Nov 2008 15:35:29 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/2007/05/08/acb2xml/#comment-38792</guid>
		<description>Hi,

I would like to know if there is a way to control the output&#039;s ColorSpace.

Thanks,
Ariel</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I would like to know if there is a way to control the output&#8217;s ColorSpace.</p>
<p>Thanks,<br />
Ariel</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on ACB2XML 2.0b &#8211; Export Adobe Color Book Data as XML by Ariel Demi</title>
		<link>http://magnetiq.com/2007/05/08/acb2xml/comment-page-1/#comment-38791</link>
		<dc:creator>Ariel Demi</dc:creator>
		<pubDate>Mon, 24 Nov 2008 15:27:51 +0000</pubDate>
		<guid isPermaLink="false">http://magnetiq.com/2007/05/08/acb2xml/#comment-38791</guid>
		<description>Very cool indeed!</description>
		<content:encoded><![CDATA[<p>Very cool indeed!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
