<?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: Prototype: &#8220;element-id&#8221;.$() instead of $(&#8216;element-id&#8217;)</title>
	<atom:link href="http://drnicwilliams.com/2006/09/11/prototype-call-dollar-on-string/feed/" rel="self" type="application/rss+xml" />
	<link>http://drnicwilliams.com/2006/09/11/prototype-call-dollar-on-string/</link>
	<description>Ruby makes Rails, Javascript makes Ajax, Dr Nic makes Magic</description>
	<lastBuildDate>Sun, 14 Mar 2010 12:52:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Dr Nic</title>
		<link>http://drnicwilliams.com/2006/09/11/prototype-call-dollar-on-string/comment-page-1/#comment-260</link>
		<dc:creator>Dr Nic</dc:creator>
		<pubDate>Tue, 12 Sep 2006 11:23:47 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2006/09/11/prototype-call-dollar-on-string/#comment-260</guid>
		<description>Yeah, I&#039;m glad I was using Firefox so I could see the error. On the Spin-off forum I think they said they might patch the original $() code so that it does more thorough testing of the arguments.

e.g argument instanceof String &#124;&#124; argument.constructor(String)

Then the method in the article should just be able to call $(this) in Firefox as well.</description>
		<content:encoded><![CDATA[<p>Yeah, I&#8217;m glad I was using Firefox so I could see the error. On the Spin-off forum I think they said they might patch the original $() code so that it does more thorough testing of the arguments.</p>
<p>e.g argument instanceof String || argument.constructor(String)</p>
<p>Then the method in the article should just be able to call $(this) in Firefox as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Revinsky</title>
		<link>http://drnicwilliams.com/2006/09/11/prototype-call-dollar-on-string/comment-page-1/#comment-259</link>
		<dc:creator>Andrew Revinsky</dc:creator>
		<pubDate>Tue, 12 Sep 2006 11:17:19 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2006/09/11/prototype-call-dollar-on-string/#comment-259</guid>
		<description>Hi everyone!

The &quot;this&quot; in your latter example refers to an inner implementation of a string in a String object. 

In IE, the &quot;this&quot; is of &quot;object&quot; type, not &quot;string&quot;. The logic of $() function, as you know, first checks whether the argument is a string (by typeof&#039;ing it) and if not, it returns this same object assuming (in our case, wrongly) it&#039;s a DOM element.

Now, in IE, it turns out, an inner string is still a string in essence (when viewed in debugger it isn&#039;t split unto characters or anything..). But in FireFox although &quot;this&quot; is still of &quot;object&quot; type, it also supports indexing (as seen by Firebug), giving access to individual constituent characters of the string.

Back to what you had, since String.prototype.$ (and &quot;this&quot; not being a strictly of &quot;string&quot; type) at the end returns the inner String&#039;s object, its output depents on inner String&#039;s object implementation in browsers.

Dr. Nic, you probably used FireFox for your tests.

Thank you!</description>
		<content:encoded><![CDATA[<p>Hi everyone!</p>
<p>The &#8220;this&#8221; in your latter example refers to an inner implementation of a string in a String object. </p>
<p>In IE, the &#8220;this&#8221; is of &#8220;object&#8221; type, not &#8220;string&#8221;. The logic of $() function, as you know, first checks whether the argument is a string (by typeof&#8217;ing it) and if not, it returns this same object assuming (in our case, wrongly) it&#8217;s a DOM element.</p>
<p>Now, in IE, it turns out, an inner string is still a string in essence (when viewed in debugger it isn&#8217;t split unto characters or anything..). But in FireFox although &#8220;this&#8221; is still of &#8220;object&#8221; type, it also supports indexing (as seen by Firebug), giving access to individual constituent characters of the string.</p>
<p>Back to what you had, since String.prototype.$ (and &#8220;this&#8221; not being a strictly of &#8220;string&#8221; type) at the end returns the inner String&#8217;s object, its output depents on inner String&#8217;s object implementation in browsers.</p>
<p>Dr. Nic, you probably used FireFox for your tests.</p>
<p>Thank you!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
