<?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>评论：修复 jQuery 中 isFunction 方法的 BUG</title>
	<atom:link href="http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/</link>
	<description>落草为根—专注前端技术&#38;&#38;关注用户体验</description>
	<lastBuildDate>Fri, 30 Jul 2010 03:14:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>来自：明城</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-8053</link>
		<dc:creator>明城</dc:creator>
		<pubDate>Wed, 23 Jun 2010 12:59:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-8053</guid>
		<description>顺便提供更进步的 toString 检测类型的信息

http://www.gracecode.com/archives/2723/</description>
		<content:encoded><![CDATA[<p>顺便提供更进步的 toString 检测类型的信息</p>
<p><a href="http://www.gracecode.com/archives/2723/" rel="nofollow">http://www.gracecode.com/archives/2723/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：天堂左我往右</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-7493</link>
		<dc:creator>天堂左我往右</dc:creator>
		<pubDate>Sat, 01 May 2010 07:00:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-7493</guid>
		<description>学习...</description>
		<content:encoded><![CDATA[<p>学习&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：修复jQuery中isFunction方法的BUG &#124; My Sky</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-7192</link>
		<dc:creator>修复jQuery中isFunction方法的BUG &#124; My Sky</dc:creator>
		<pubDate>Mon, 12 Apr 2010 15:26:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-7192</guid>
		<description>[...] 本文来自：http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/      标签:         评论 (0) 发表评论 [...]</description>
		<content:encoded><![CDATA[<p>[...] 本文来自：http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/      标签:         评论 (0) 发表评论 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：优酷</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-7129</link>
		<dc:creator>优酷</dc:creator>
		<pubDate>Wed, 07 Apr 2010 03:12:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-7129</guid>
		<description>工作中不忘记学习 和写blog· 学习</description>
		<content:encoded><![CDATA[<p>工作中不忘记学习 和写blog· 学习</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：prcjack</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-6438</link>
		<dc:creator>prcjack</dc:creator>
		<pubDate>Sun, 07 Feb 2010 09:28:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-6438</guid>
		<description>在加上 渔隐 所提醒的valueOf判断，应该可以修复bug</description>
		<content:encoded><![CDATA[<p>在加上 渔隐 所提醒的valueOf判断，应该可以修复bug</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：prcjack</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-6437</link>
		<dc:creator>prcjack</dc:creator>
		<pubDate>Sun, 07 Feb 2010 09:16:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-6437</guid>
		<description>经测试，alert等window方法和getElementById等dom方法在ie下的toString为undefind。</description>
		<content:encoded><![CDATA[<p>经测试，alert等window方法和getElementById等dom方法在ie下的toString为undefind。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：kangre</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-6191</link>
		<dc:creator>kangre</dc:creator>
		<pubDate>Wed, 27 Jan 2010 09:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-6191</guid>
		<description>哇，看到我头都晕了，看来真的要自我增值了。。。</description>
		<content:encoded><![CDATA[<p>哇，看到我头都晕了，看来真的要自我增值了。。。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：怿飞</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-6172</link>
		<dc:creator>怿飞</dc:creator>
		<pubDate>Mon, 25 Jan 2010 08:56:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-6172</guid>
		<description>@dongyuwei 谢谢，的确还有问题。

test = {}

test.toString = function(){
    return &#039;function&#039;;
}

alert(/^\s*\bfunction\b/.test(&#039;&#039; + test));</description>
		<content:encoded><![CDATA[<p>@dongyuwei 谢谢，的确还有问题。</p>
<p>test = {}</p>
<p>test.toString = function(){<br />
    return &#8216;function&#8217;;<br />
}</p>
<p>alert(/^\s*\bfunction\b/.test(&#8221; + test));</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：dongyuwei</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-6171</link>
		<dc:creator>dongyuwei</dc:creator>
		<pubDate>Mon, 25 Jan 2010 08:28:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-6171</guid>
		<description>return /^\s*\bfunction\b/.test(&quot;&quot; + fn); 这里有个bug很明显：fn是函数指针，&quot;&quot; + fn实际会执行&quot;&quot;+fn.toString();如果之前有人故意把fn.toString重载了，则该判断必然失效。
测试如下：
function test(){
	alert(&quot;just test&quot;);
}

//重载toString
test.toString = function(){

};
alert((&quot;&quot; + test) === &quot;undefined&quot;);//true</description>
		<content:encoded><![CDATA[<p>return /^\s*\bfunction\b/.test(&#8220;&#8221; + fn); 这里有个bug很明显：fn是函数指针，&#8221;" + fn实际会执行&#8221;"+fn.toString();如果之前有人故意把fn.toString重载了，则该判断必然失效。<br />
测试如下：<br />
function test(){<br />
	alert(&#8220;just test&#8221;);<br />
}</p>
<p>//重载toString<br />
test.toString = function(){</p>
<p>};<br />
alert((&#8220;&#8221; + test) === &#8220;undefined&#8221;);//true</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：行骏</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-6165</link>
		<dc:creator>行骏</dc:creator>
		<pubDate>Sun, 24 Jan 2010 13:08:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-6165</guid>
		<description>又见惰性函数！...</description>
		<content:encoded><![CDATA[<p>又见惰性函数！&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：怿飞</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-6163</link>
		<dc:creator>怿飞</dc:creator>
		<pubDate>Sun, 24 Jan 2010 02:26:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-6163</guid>
		<description>@渔隐 &lt;del datetime=&quot;2010-02-08T03:41:41+00:00&quot;&gt;你再测试一下，你所说的例子，应该可以处理的，&lt;/del&gt;因为正则里用的是^\s*，避免了这些极端的情况。再则，正则的效率相对还是没有原来的方式效率高的。</description>
		<content:encoded><![CDATA[<p>@渔隐 <del datetime="2010-02-08T03:41:41+00:00">你再测试一下，你所说的例子，应该可以处理的，</del>因为正则里用的是^\s*，避免了这些极端的情况。再则，正则的效率相对还是没有原来的方式效率高的。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：渔隐</title>
		<link>http://www.planabc.net/2010/01/23/repair_the_bug_of_isfunction_method_in_jquery/comment-page-1/#comment-6161</link>
		<dc:creator>渔隐</dc:creator>
		<pubDate>Sat, 23 Jan 2010 16:21:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.planabc.net/?p=376#comment-6161</guid>
		<description>顶师父，不错的方法，可惜IE还是无法正确处理这种极端情况：
var obj = {toString:void 0,valueOf:function(){return &#039;function xx&#039;;}};
alert(isFunction(obj));

如果排除这种极端情况，其实所有浏览器都是支持return /^\s*\bfunction\b/.test(&quot;&quot; + fn);的，又何必分开呢？</description>
		<content:encoded><![CDATA[<p>顶师父，不错的方法，可惜IE还是无法正确处理这种极端情况：<br />
var obj = {toString:void 0,valueOf:function(){return &#8216;function xx&#8217;;}};<br />
alert(isFunction(obj));</p>
<p>如果排除这种极端情况，其实所有浏览器都是支持return /^\s*\bfunction\b/.test(&#8220;&#8221; + fn);的，又何必分开呢？</p>
]]></content:encoded>
	</item>
</channel>
</rss>
