<?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"
	>
<channel>
	<title>Comments on: Bookmarklet</title>
	<atom:link href="http://realazy.org/blog/2008/02/25/bookmarklet/feed/" rel="self" type="application/rss+xml" />
	<link>http://realazy.org/blog/2008/02/25/bookmarklet/</link>
	<description>web 标准，前端开发，编程感悟，生活杂想</description>
	<pubDate>Mon, 13 Oct 2008 08:15:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Bookmarklet - 小书签，实用浏览器小工具补完 &#8212; 绿色软件联盟</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-79756</link>
		<dc:creator>Bookmarklet - 小书签，实用浏览器小工具补完 &#8212; 绿色软件联盟</dc:creator>
		<pubDate>Tue, 29 Jul 2008 22:49:20 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-79756</guid>
		<description>[...] 另外 realazy 的文章在讨论写 bookmarklet 的注意点。 [...]</description>
		<content:encoded><![CDATA[<p>[...] 另外 realazy 的文章在讨论写 bookmarklet 的注意点。 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fdcn</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-70343</link>
		<dc:creator>fdcn</dc:creator>
		<pubDate>Sun, 22 Jun 2008 13:18:14 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-70343</guid>
		<description>lone,你沒有仔細看hax寫的東西，他從來沒用function(){}()，他寫的是：
void function(){}()</description>
		<content:encoded><![CDATA[<p>lone,你沒有仔細看hax寫的東西，他從來沒用function(){}()，他寫的是：<br />
void function(){}()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lone</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-64121</link>
		<dc:creator>lone</dc:creator>
		<pubDate>Mon, 12 May 2008 07:54:31 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-64121</guid>
		<description>看了realazy给的文档,觉得恰当的写法应该是:
javascript:void(function(){}());
还有,关于hax的"例如：
function(){}()
这个语法是错误的。你必须写成：
(function(){})()"
写成(function(){}())"是一样的,只要得到的是表达式就可以了~</description>
		<content:encoded><![CDATA[<p>看了realazy给的文档,觉得恰当的写法应该是:<br />
javascript:void(function(){}());<br />
还有,关于hax的&#8221;例如：<br />
function(){}()<br />
这个语法是错误的。你必须写成：<br />
(function(){})()&#8221;<br />
写成(function(){}())&#8221;是一样的,只要得到的是表达式就可以了~</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hax</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-48980</link>
		<dc:creator>hax</dc:creator>
		<pubDate>Sun, 16 Mar 2008 08:46:33 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-48980</guid>
		<description>最后那个，我是指插入script标签。反正script标签没有domain的限制。不过这也说明bookmarklet是可以用来干坏事的，所以安装bookmarklet的时候也要小心。</description>
		<content:encoded><![CDATA[<p>最后那个，我是指插入script标签。反正script标签没有domain的限制。不过这也说明bookmarklet是可以用来干坏事的，所以安装bookmarklet的时候也要小心。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hax</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-48977</link>
		<dc:creator>hax</dc:creator>
		<pubDate>Sun, 16 Mar 2008 08:43:16 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-48977</guid>
		<description>使用void的原因除了保持一致（即使对于不返回值的function也用void）之外，还有一个原因是void会强制function成为function表达式而不是function声明。例如：
function(){}()
这个语法是错误的。你必须写成：
(function(){})()
即用括号来强制得到一个function表达式，而：
void function(){}()
这个语法是正确的（虽然有极少数引擎会报错，那是它们的实现bug）。
所以realazy同志给出的格式太过繁琐了，可以去掉两对括号。我们应该更lazy一点呵呵。
这也是为什么有些人喜欢用new function(){...}，因为它连后面的一对括号也可以省略掉。如果我们使用function的唯一目的是为了建立一个封闭的Scope以便控制对全局命名空间的污染，那么我们总会倾向于最简单，最少视觉干扰的方案。
最后关于ie的长度限制，我给个稍有点无赖的解决方案，那就是在bookmarklet中给文档插入新的标签，loading你的网站的脚本，呵呵。</description>
		<content:encoded><![CDATA[<p>使用void的原因除了保持一致（即使对于不返回值的function也用void）之外，还有一个原因是void会强制function成为function表达式而不是function声明。例如：<br />
function(){}()<br />
这个语法是错误的。你必须写成：<br />
(function(){})()<br />
即用括号来强制得到一个function表达式，而：<br />
void function(){}()<br />
这个语法是正确的（虽然有极少数引擎会报错，那是它们的实现bug）。<br />
所以realazy同志给出的格式太过繁琐了，可以去掉两对括号。我们应该更lazy一点呵呵。<br />
这也是为什么有些人喜欢用new function(){&#8230;}，因为它连后面的一对括号也可以省略掉。如果我们使用function的唯一目的是为了建立一个封闭的Scope以便控制对全局命名空间的污染，那么我们总会倾向于最简单，最少视觉干扰的方案。<br />
最后关于ie的长度限制，我给个稍有点无赖的解决方案，那就是在bookmarklet中给文档插入新的标签，loading你的网站的脚本，呵呵。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FLY</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-48034</link>
		<dc:creator>FLY</dc:creator>
		<pubDate>Tue, 11 Mar 2008 08:57:32 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-48034</guid>
		<description>对于这方面了解的倒是不多。
只是在互联网上这种应该算是web2.0类型的吧
只知道概念，对于技术层面还不是很了解。</description>
		<content:encoded><![CDATA[<p>对于这方面了解的倒是不多。<br />
只是在互联网上这种应该算是web2.0类型的吧<br />
只知道概念，对于技术层面还不是很了解。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sv</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45699</link>
		<dc:creator>sv</dc:creator>
		<pubDate>Wed, 27 Feb 2008 03:14:51 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45699</guid>
		<description>其实这种也很常见，把它bookmark起来的想法倒是很新颖。在你的blog上潜了N久的水，都没怎么留言过，不好意思。特推荐个bookmarklet----Javascrip Dom Inspector: javascript:void(z=document.body.appendChild(document.createElement('script')));void(z.language='javascript');void(z.type='text/javascript');void(z.src='http://slayeroffice.com/tools/modi/modi.js');void(z.id='modi');
Check it out &#38; bookmark it ;-)</description>
		<content:encoded><![CDATA[<p>其实这种也很常见，把它bookmark起来的想法倒是很新颖。在你的blog上潜了N久的水，都没怎么留言过，不好意思。特推荐个bookmarklet&#8212;-Javascrip Dom Inspector: javascript:void(z=document.body.appendChild(document.createElement(&#8217;script&#8217;)));void(z.language=&#8217;javascript&#8217;);void(z.type=&#8217;text/javascript&#8217;);void(z.src=&#8217;http://slayeroffice.com/tools/modi/modi.js&#8217;);void(z.id=&#8217;modi&#8217;);<br />
Check it out &amp; bookmark it <img src='http://realazy.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lunatic Sun</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45473</link>
		<dc:creator>Lunatic Sun</dc:creator>
		<pubDate>Mon, 25 Feb 2008 04:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45473</guid>
		<description>@realazy - 那句代码应该是javascript : void(i = 0)，谢谢！

另外我的意思是当你使用闭包的时候，如

javascript : (function(){
    window.open();
})();

并不会产生返回值，因为在函数中除非你使用return语句，否则函数都将返回undefined。因此只要匿名函数没有返回值，就不需要使用void操作符。

使用void操作符的正确原因在于那些会直接返回值的语句，如

javascript : i = 0;

这条代码将在document中写下0</description>
		<content:encoded><![CDATA[<p>@realazy - 那句代码应该是javascript : void(i = 0)，谢谢！</p>
<p>另外我的意思是当你使用闭包的时候，如</p>
<p>javascript : (function(){<br />
    window.open();<br />
})();</p>
<p>并不会产生返回值，因为在函数中除非你使用return语句，否则函数都将返回undefined。因此只要匿名函数没有返回值，就不需要使用void操作符。</p>
<p>使用void操作符的正确原因在于那些会直接返回值的语句，如</p>
<p>javascript : i = 0;</p>
<p>这条代码将在document中写下0</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: realazy</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45468</link>
		<dc:creator>realazy</dc:creator>
		<pubDate>Mon, 25 Feb 2008 03:11:58 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45468</guid>
		<description>@Lunatic Sun 比如 &lt;code&gt;window.open&lt;/code&gt;，如果不使用 &lt;code&gt;void&lt;/code&gt;, 就得到返回的 &lt;code&gt;window&lt;/code&gt; 对象。

另外，你所举的例子有语法错误。</description>
		<content:encoded><![CDATA[<p>@Lunatic Sun 比如 <code>window.open</code>，如果不使用 <code>void</code>, 就得到返回的 <code>window</code> 对象。</p>
<p>另外，你所举的例子有语法错误。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lunatic Sun</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45466</link>
		<dc:creator>Lunatic Sun</dc:creator>
		<pubDate>Mon, 25 Feb 2008 02:43:17 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45466</guid>
		<description>许多bookmarklet都使用void操作符，将可能的表达式返回值设置为undefined。如

javascript: void ( var i = 0 ) ;

但是在我测试时发现除了显性的使用return语句返回值以外的情况都不会产生返回值的情况，我不知道是不是因为我测试使用的浏览器都是21世纪的浏览器的关系。</description>
		<content:encoded><![CDATA[<p>许多bookmarklet都使用void操作符，将可能的表达式返回值设置为undefined。如</p>
<p>javascript: void ( var i = 0 ) ;</p>
<p>但是在我测试时发现除了显性的使用return语句返回值以外的情况都不会产生返回值的情况，我不知道是不是因为我测试使用的浏览器都是21世纪的浏览器的关系。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 家儒</title>
		<link>http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45430</link>
		<dc:creator>家儒</dc:creator>
		<pubDate>Sun, 24 Feb 2008 19:13:50 +0000</pubDate>
		<guid isPermaLink="false">http://realazy.org/blog/2008/02/25/bookmarklet/#comment-45430</guid>
		<description>希望了解更多 ^^</description>
		<content:encoded><![CDATA[<p>希望了解更多 ^^</p>
]]></content:encoded>
	</item>
</channel>
</rss>
