<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.4" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: this.options - setting defaults that can be overwritten in your classes</title>
	<link>http://clientside.cnet.com/best-practices/thisoptions-setting-defaults-that-can-be-overwritten-in-your-classes/</link>
	<description>Making stuff work on the other side of the request.</description>
	<pubDate>Fri, 08 Aug 2008 21:33:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.4</generator>

	<item>
		<title>by: Beware: object = object has a pitfall &#187; Clientside</title>
		<link>http://clientside.cnet.com/best-practices/thisoptions-setting-defaults-that-can-be-overwritten-in-your-classes/#comment-4073</link>
		<pubDate>Sat, 13 Jan 2007 01:54:11 +0000</pubDate>
		<guid>http://clientside.cnet.com/best-practices/thisoptions-setting-defaults-that-can-be-overwritten-in-your-classes/#comment-4073</guid>
					<description>[...] So I spent an entire day discovering a quirk about javascript that I must now share. In a previous post on creating default settings for classes/objects I discussed the following technique:  PLAIN TEXT JavaScript:  var Widget = new Class&#40;&#123; initialize: function&#40;element, options&#41;&#123; this.element = element; this.options = Object.extend&#40;&#123; offsetX: 0, offsetY: 0 &#125;, options &#124;&#124; &#123;&#125;&#41;; this.setPosition&#40;&#41;; &#125;, setPosition: function&#40;&#41;&#123; this.element.setStyles&#40;&#123; left: this.options.offsetX + 'px', top: this.options.offsetY + 'px' &#125;&#41;; &#125; &#125;&#41;; [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] So I spent an entire day discovering a quirk about javascript that I must now share. In a previous post on creating default settings for classes/objects I discussed the following technique:  PLAIN TEXT JavaScript:  var Widget = new Class&#40;&#123; initialize: function&#40;element, options&#41;&#123; this.element = element; this.options = Object.extend&#40;&#123; offsetX: 0, offsetY: 0 &#125;, options || &#123;&#125;&#41;; this.setPosition&#40;&#41;; &#125;, setPosition: function&#40;&#41;&#123; this.element.setStyles&#40;&#123; left: this.options.offsetX + &#8216;px&#8217;, top: this.options.offsetY + &#8216;px&#8217; &#125;&#41;; &#125; &#125;&#41;; [&#8230;]
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Aaron N.</title>
		<link>http://clientside.cnet.com/best-practices/thisoptions-setting-defaults-that-can-be-overwritten-in-your-classes/#comment-65</link>
		<pubDate>Mon, 20 Nov 2006 16:45:06 +0000</pubDate>
		<guid>http://clientside.cnet.com/best-practices/thisoptions-setting-defaults-that-can-be-overwritten-in-your-classes/#comment-65</guid>
					<description>Hi Cody,

I really appreciate you sharing this example, but I don't think it's quite the same concept. The way that my example above works lets you set defaults and the user passes in their own options that overwrite any portion of those defaults. In your tooltip example, you add a bunch of options together with those passed in, but the user doesn't have any way to alter the defaults.</description>
		<content:encoded><![CDATA[<p>Hi Cody,</p>
<p>I really appreciate you sharing this example, but I don&#8217;t think it&#8217;s quite the same concept. The way that my example above works lets you set defaults and the user passes in their own options that overwrite any portion of those defaults. In your tooltip example, you add a bunch of options together with those passed in, but the user doesn&#8217;t have any way to alter the defaults.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: cody lindley</title>
		<link>http://clientside.cnet.com/best-practices/thisoptions-setting-defaults-that-can-be-overwritten-in-your-classes/#comment-64</link>
		<pubDate>Sat, 18 Nov 2006 13:51:49 +0000</pubDate>
		<guid>http://clientside.cnet.com/best-practices/thisoptions-setting-defaults-that-can-be-overwritten-in-your-classes/#comment-64</guid>
					<description>A great coding example of this is the following prototype tooltip code:

http://blog.innerewut.de/files/tooltip/tooltip-v0.1.js</description>
		<content:encoded><![CDATA[<p>A great coding example of this is the following prototype tooltip code:</p>
<p><a href='http://blog.innerewut.de/files/tooltip/tooltip-v0.1.js' rel='nofollow'>http://blog.innerewut.de/files/tooltip/tooltip-v0.1.js</a>
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Aaron N.</title>
		<link>http://clientside.cnet.com/best-practices/thisoptions-setting-defaults-that-can-be-overwritten-in-your-classes/#comment-61</link>
		<pubDate>Wed, 15 Nov 2006 02:07:49 +0000</pubDate>
		<guid>http://clientside.cnet.com/best-practices/thisoptions-setting-defaults-that-can-be-overwritten-in-your-classes/#comment-61</guid>
					<description>In my haste to just throw this up, my example had a couple of errors. Despite the fact that there's no reason to execute this to illustrate the point, I don't want to confuse anyone; I've updated the examples.</description>
		<content:encoded><![CDATA[<p>In my haste to just throw this up, my example had a couple of errors. Despite the fact that there&#8217;s no reason to execute this to illustrate the point, I don&#8217;t want to confuse anyone; I&#8217;ve updated the examples.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
