<?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: deleting window properties</title>
	<atom:link href="http://kozak.si/widethoughts/2009/11/08/deleting-window-and-document-properties/feed/" rel="self" type="application/rss+xml" />
	<link>http://kozak.si/widethoughts/2009/11/08/deleting-window-and-document-properties/</link>
	<description>a blog of one of those ... software developer creatures</description>
	<lastBuildDate>Tue, 08 Jun 2010 19:02:36 +0200</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Gašper</title>
		<link>http://kozak.si/widethoughts/2009/11/08/deleting-window-and-document-properties/comment-page-1/#comment-1099</link>
		<dc:creator>Gašper</dc:creator>
		<pubDate>Sun, 08 Nov 2009 22:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://kozak.si/widethoughts/?p=533#comment-1099</guid>
		<description>Yes, that&#039;s a good example of how it could be done, but alas, the code we&#039;re using is out in the wild, we&#039;d have to support the current model for backwards compatibility, and it would take a lot of time before everybody would change to the new model (we may be talking years here; we already changed a little thing 2 years ago, and some users still haven&#039;t switched). This is one of those things where quick decisions, based on what&#039;s used elsewhere, come back to haunt you years later. :)

As for setting default values instead of unsetting variables, it&#039;s a good idea, and will think about it. It should work in theory, but depends on how everything else in our JS works. Also, unsetting variables makes sure our ad blocks don&#039;t leave any traces behind, so other javascripts are unable to read these values, so it acts as a security measure as well. But as I said, I&#039;ll think this through the next time I touch this. Thanks for the idea. :)</description>
		<content:encoded><![CDATA[<p>Yes, that&#8217;s a good example of how it could be done, but alas, the code we&#8217;re using is out in the wild, we&#8217;d have to support the current model for backwards compatibility, and it would take a lot of time before everybody would change to the new model (we may be talking years here; we already changed a little thing 2 years ago, and some users still haven&#8217;t switched). This is one of those things where quick decisions, based on what&#8217;s used elsewhere, come back to haunt you years later. <img src='http://kozak.si/widethoughts/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>As for setting default values instead of unsetting variables, it&#8217;s a good idea, and will think about it. It should work in theory, but depends on how everything else in our JS works. Also, unsetting variables makes sure our ad blocks don&#8217;t leave any traces behind, so other javascripts are unable to read these values, so it acts as a security measure as well. But as I said, I&#8217;ll think this through the next time I touch this. Thanks for the idea. <img src='http://kozak.si/widethoughts/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matjaž Lipuš</title>
		<link>http://kozak.si/widethoughts/2009/11/08/deleting-window-and-document-properties/comment-page-1/#comment-1098</link>
		<dc:creator>Matjaž Lipuš</dc:creator>
		<pubDate>Sun, 08 Nov 2009 22:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://kozak.si/widethoughts/?p=533#comment-1098</guid>
		<description>Well, I sort off agree with you, it&#039;s industry standard, because it&#039;s simple, but it is also simple solvable with objects:

httpool = {size:1};
ad(httpool);
httpool = {size:2, border: &quot;red&quot;};
ad(httpool);

These are two different object so you don&#039;t need to unset values when checking for property existence.
If I borrow jQuery&#039;s extend function your ad function would look like:
defaults = {
	size: 1,
	border: &quot;blue&quot;
};
function ad(options)
{
	options = jQuery.extend({}, defaults, options);
	options.size...
	options.border...
}


P.S.
Just crossed my mind, instead of unsetting values just set default ones :)</description>
		<content:encoded><![CDATA[<p>Well, I sort off agree with you, it&#8217;s industry standard, because it&#8217;s simple, but it is also simple solvable with objects:</p>
<p>httpool = {size:1};<br />
ad(httpool);<br />
httpool = {size:2, border: &#8220;red&#8221;};<br />
ad(httpool);</p>
<p>These are two different object so you don&#8217;t need to unset values when checking for property existence.<br />
If I borrow jQuery&#8217;s extend function your ad function would look like:<br />
defaults = {<br />
	size: 1,<br />
	border: &#8220;blue&#8221;<br />
};<br />
function ad(options)<br />
{<br />
	options = jQuery.extend({}, defaults, options);<br />
	options.size&#8230;<br />
	options.border&#8230;<br />
}</p>
<p>P.S.<br />
Just crossed my mind, instead of unsetting values just set default ones <img src='http://kozak.si/widethoughts/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gašper</title>
		<link>http://kozak.si/widethoughts/2009/11/08/deleting-window-and-document-properties/comment-page-1/#comment-1097</link>
		<dc:creator>Gašper</dc:creator>
		<pubDate>Sun, 08 Nov 2009 21:49:23 +0000</pubDate>
		<guid isPermaLink="false">http://kozak.si/widethoughts/?p=533#comment-1097</guid>
		<description>window.p isn&#039;t the horrible kind of a global variable. Yes, it&#039;s available globally, but it&#039;s set directly onto an object (window) and therefore has its place (namespace if you will). This differs significantly from setting just p = 34; anywhere, because in that case the visibility is determined by the scope.

I found this out when I was developing our advertising javascript code (the so-called invocation code). There, the user sets some variables, such as:
httpool_publisher_id = &#039;1234567890&#039;;
httpool_color_border = &#039;#f0f0f0&#039;;
etc.
And then includes our ad-serving javascript, which serves a single ad block with the predefined configuration.

But not all of these variables are required. When a variable isn&#039;t set, the default value should be used. But in order to detect which isn&#039;t set, I have to unset all of them after initializing the ad block, otherwise the values might leak into the next block -- by not being set in the invocation code of the next block.

It&#039;s a very specific case and I can&#039;t really resort to namespaces, because it&#039;s user-land code and an industry standard. :)</description>
		<content:encoded><![CDATA[<p>window.p isn&#8217;t the horrible kind of a global variable. Yes, it&#8217;s available globally, but it&#8217;s set directly onto an object (window) and therefore has its place (namespace if you will). This differs significantly from setting just p = 34; anywhere, because in that case the visibility is determined by the scope.</p>
<p>I found this out when I was developing our advertising javascript code (the so-called invocation code). There, the user sets some variables, such as:<br />
httpool_publisher_id = &#8216;1234567890&#8242;;<br />
httpool_color_border = &#8216;#f0f0f0&#8242;;<br />
etc.<br />
And then includes our ad-serving javascript, which serves a single ad block with the predefined configuration.</p>
<p>But not all of these variables are required. When a variable isn&#8217;t set, the default value should be used. But in order to detect which isn&#8217;t set, I have to unset all of them after initializing the ad block, otherwise the values might leak into the next block &#8212; by not being set in the invocation code of the next block.</p>
<p>It&#8217;s a very specific case and I can&#8217;t really resort to namespaces, because it&#8217;s user-land code and an industry standard. <img src='http://kozak.si/widethoughts/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matjaž Lipuš</title>
		<link>http://kozak.si/widethoughts/2009/11/08/deleting-window-and-document-properties/comment-page-1/#comment-1096</link>
		<dc:creator>Matjaž Lipuš</dc:creator>
		<pubDate>Sun, 08 Nov 2009 21:33:29 +0000</pubDate>
		<guid isPermaLink="false">http://kozak.si/widethoughts/?p=533#comment-1096</guid>
		<description>Although IE JS engine is buggy setting global variables is evil and moreover deleting them is even worse.
Try to use namespace (object).
What&#039;s your use case for this? How did you discover this? :D</description>
		<content:encoded><![CDATA[<p>Although IE JS engine is buggy setting global variables is evil and moreover deleting them is even worse.<br />
Try to use namespace (object).<br />
What&#8217;s your use case for this? How did you discover this? <img src='http://kozak.si/widethoughts/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
