<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Leeiio Chaos Made.設計</title>
	<atom:link href="http://leeiio.me/category/design/feed/" rel="self" type="application/rss+xml" />
	<link>http://leeiio.me</link>
	<description>The world is golden. 关注前端，后台，电影，音乐，摄影，设计。我是个兴趣广泛滴人。</description>
	<lastBuildDate>Tue, 20 Jul 2010 14:51:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://leeiio.me/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://leeiio.me/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=cat&id=3_1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>溢出文本显示省略号,关于text-overflow:ellipsis的那些事</title>
		<link>http://leeiio.me/text-overflow-ellipsis/</link>
		<comments>http://leeiio.me/text-overflow-ellipsis/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 06:49:26 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[(X)HTML/CSS/XML/XSL]]></category>
		<category><![CDATA[JS/Ajax/AS/Flex]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=2055</guid>
		<description><![CDATA[这个标题其实已经是一个老生常谈的问题了。很多时候，比如网站最基本的文章列表，标题会很长，而显示列表的区域宽度却没有这么宽，这时候最正常的做法就是让超出宽度的部分文字用省略号(&#8230;)来表示。通常做法是网站后台程序截取一定的字符然后输出到前台显示或者前台用javascript截取一定的字符，但是通过控制字数来截取的话还是存在一个大问题的，因为中文和英文的字符宽度问题，这个字数不好控制，而且通用性较差。那么有没有更好的方法呢，比如直接用CSS来解决的，当然是有的。 text-overflow是一个比较特殊的属性，W3C早前的文档中（目前的文档中没有包含text-overflow属性，FML!）对其的定义是: Name: text-overflow-mode Value: clip &#124; ellipsis &#124; ellipsis-word clip : 　不显示省略标记（&#8230;），而是简单的裁切 ellipsis : 　当对象内文本溢出时显示省略标记（&#8230;），省略标记插入的位置是最后一个字符。 ellipsis-word : 　当对象内文本溢出时显示省略标记（&#8230;），省略标记插入的位置是最后一个词（word）。 至于为什么一开始我说text-overflow是一个比较特殊的样式呢？因为我们可以用它代替我们通常所用的标题截取函数，而且这样做对搜索引擎更加友好，如：标题文件有50个汉字，而我们的列表可能只有300px的宽度。如果用标题截取函数，则标题不是完整的，如果我们用CSS样式text-overflow:ellipsis，输出的标题是完整的，只是受容器大小的局限不显示出来罢了（表现上是超出部分显示省略标记&#8230;）。 text-overflow: ellipsis属性仅是注解，当文本溢出时是否显示省略标记。并不具备其它的样式属性定义。我们想要实现溢出时产生省略号的效果。还必须定义：强制文本在一行内显示（white-space:nowrap）及溢出内容为隐藏（overflow:hidden）。只有这样才能实现溢出文本显示省略号的效果。Via. 那么，如果我们要给p标签定义text-overflow:ellipsis就可以这么写： p &#123; white-space: nowrap; width: 100%; /* IE6 需要定义宽度 */ overflow: hidden; &#160; -o-text-overflow: ellipsis; /* Opera */ text-overflow: ellipsis; /* IE, Safari (WebKit) */ &#125; 使用样式前： 我是一段测试文字，请分别用IE，Safari，chrome，opera浏览器查看我哦！ 使用样式后： 我是一段加长过的测试文字，请分别用IE，Safari，chrome，opera浏览器查看我哦！哈哈哈，看到省略号了么？ 浏览器兼容状况 table.standard-table [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://imgs.leeiio.me/blogimgs/2010/07/20100718-ellipsis.jpg" alt="溢出文本显示省略号,关于text-overflow:ellipsis的那些事" /><br />
这个标题其实已经是一个老生常谈的问题了。很多时候，比如网站最基本的文章列表，标题会很长，而显示列表的区域宽度却没有这么宽，这时候最正常的做法就是让超出宽度的部分文字用省略号(&#8230;)来表示。通常做法是网站后台程序截取一定的字符然后输出到前台显示或者前台用javascript截取一定的字符，但是通过控制字数来截取的话还是存在一个大问题的，因为中文和英文的字符宽度问题，这个字数不好控制，而且通用性较差。那么有没有更好的方法呢，比如直接用CSS来解决的，当然是有的。<br />
<span id="more-2055"></span><br />
text-overflow是一个比较特殊的属性，<a rel="nofollow" href="http://www.w3.org/TR/2003/CR-css3-text-20030514/#text-overflow-mode">W3C早前的文档中</a>（<a rel="nofollow" href="http://www.w3.org/TR/css3-text/">目前的文档</a>中没有包含text-overflow属性，FML!）对其的定义是:</p>
<blockquote><p>Name:	text-overflow-mode<br />
Value:	clip | ellipsis | ellipsis-word</p></blockquote>
<p>clip : 　不显示省略标记（&#8230;），而是简单的裁切<br />
ellipsis : 　当对象内文本溢出时显示省略标记（&#8230;），省略标记插入的位置是最后一个字符。<br />
ellipsis-word : 　当对象内文本溢出时显示省略标记（&#8230;），省略标记插入的位置是最后一个词（word）。</p>
<p>至于为什么一开始我说text-overflow是一个比较特殊的样式呢？因为我们可以用它代替我们通常所用的标题截取函数，而且这样做对搜索引擎更加友好，如：标题文件有50个汉字，而我们的列表可能只有300px的宽度。如果用标题截取函数，则标题不是完整的，如果我们用CSS样式text-overflow:ellipsis，输出的标题是完整的，只是受容器大小的局限不显示出来罢了（表现上是超出部分显示省略标记&#8230;）。</p>
<p>text-overflow: ellipsis属性仅是注解，当文本溢出时是否显示省略标记。并不具备其它的样式属性定义。我们想要实现溢出时产生省略号的效果。还必须定义：强制文本在一行内显示（white-space:nowrap）及溢出内容为隐藏（overflow:hidden）。只有这样才能实现溢出文本显示省略号的效果。<a rel="nofollow" href="http://www.52css.com/article.asp?id=602">Via.</a></p>
<p>那么，如果我们要给p标签定义text-overflow:ellipsis就可以这么写：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">nowrap</span><span style="color: #00AA00;">;</span>
      <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>                  <span style="color: #808080; font-style: italic;">/* IE6 需要定义宽度 */</span>
      <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>             
&nbsp;
      -o-text-<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> ellipsis<span style="color: #00AA00;">;</span>    <span style="color: #808080; font-style: italic;">/* Opera */</span>
      text-<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span>    ellipsis<span style="color: #00AA00;">;</span>    <span style="color: #808080; font-style: italic;">/* IE, Safari (WebKit) */</span>
   <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><em>使用样式前：</em></p>
<p class="example">我是一段测试文字，请分别用IE，Safari，chrome，opera浏览器查看我哦！</p>
<p><em>使用样式后：</em></p>
<p class="example ellipsis-1">我是一段加长过的测试文字，请分别用IE，Safari，chrome，opera浏览器查看我哦！哈哈哈，看到省略号了么？</p>
<p><strong>浏览器兼容状况</strong></p>
<style type="text/css">
table.standard-table {
border: 1px solid #BBB;
border-collapse: collapse;
}
table.standard-table td.header, table.standard-table th {
background: #EEE;
border: 1px solid #BBB;
font-weight: bold;
padding: 0px 5px;
text-align: left;
}
table.standard-table td {
border: 1px solid #CCC;
padding: 5px;
text-align: left;
vertical-align: top;
}
.example{background:#ddd;border:2px solid #bbb;width: 600px;display:block}
.ellipsis-1{
      white-space: nowrap;
      overflow: hidden;    
      -o-text-overflow: ellipsis;    /* Opera */
      text-overflow:    ellipsis;    /* IE, Safari (WebKit) */
}
.xul{
-moz-binding: url('../ellipsis.xml#ellipsis');
}
</style>
<table class="standard-table">
<tbody>
<tr>
<th>Browser</th>
<th>Lowest Version</th>
<th>Support of</th>
</tr>
<tr>
<td>Internet Explorer</td>
<td><strong>6.0</strong></td>
<td>text-overflow</td>
</tr>
<tr>
<td>Firefox (Gecko)</td>
<td>&#8212;</td>
<td>&#8212;</td>
</tr>
<tr>
<td>Opera</td>
<td><strong>9.0</strong></td>
<td>-o-text-overflow</td>
</tr>
<tr>
<td>Safari (WebKit)</td>
<td><strong>1.3</strong> (312.3)</td>
<td>text-overflow</td>
</tr>
</tbody>
</table>
<p><em>OH,FML!Firefox不支持这个属性！</em>这回，Firefox你也太另类了吧！还有别的办法么，当然有，方法还挺多的。<br />
比如Mozilla developer center推荐的<a href="https://developer.mozilla.org/En/CSS/-moz-binding" rel="nofollow">-moz-binding</a> CSS属性。Mozilla developer center给出的理由是text-overflow没有W3C的规范&#8230;但是因为Firefox支持XUL，一种XML的用户界面语言。并且Firefox还支持XBL，一种XML绑定语言，这样我们就可以使用Mozilla developer center推荐的<a href="https://developer.mozilla.org/En/CSS/-moz-binding" rel="nofollow">-moz-binding</a> CSS属性来绑定XUL里的ellipsis属性了。</p>
<h4 class="part-title">1.XUL方式</h4>
<p>首先，我们创建XUL，它应该被保存为ellipsis.xml：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>  
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bindings</span>   </span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.mozilla.org/xbl&quot;</span>  </span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:xbl</span>=<span style="color: #ff0000;">&quot;http://www.mozilla.org/xbl&quot;</span>  </span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:xul</span>=<span style="color: #ff0000;">&quot;http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul&quot;</span>  </span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;binding</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;ellipsis&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>  
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xul:window<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xul:description</span> <span style="color: #000066;">crop</span>=<span style="color: #ff0000;">&quot;end&quot;</span> <span style="color: #000066;">xbl:inherits</span>=<span style="color: #ff0000;">&quot;value=xbl:text&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;children</span><span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/xul:description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xul:window<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/binding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bindings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>然后我们需要把这个xml文件放到一个目录，原来的css需要加一条，变成这样</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">nowrap</span><span style="color: #00AA00;">;</span>
      <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>                  <span style="color: #808080; font-style: italic;">/* IE6 需要定义宽度 */</span>
      <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>             
&nbsp;
      -o-text-<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> ellipsis<span style="color: #00AA00;">;</span>    <span style="color: #808080; font-style: italic;">/* Opera */</span>
      text-<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span>    ellipsis<span style="color: #00AA00;">;</span>    <span style="color: #808080; font-style: italic;">/* IE, Safari (WebKit) */</span>
      -moz-binding<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'ellipsis.xml#ellipsis'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>    <span style="color: #808080; font-style: italic;">/* Firefox */</span>
   <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>虽然Firefox通过XUL的方式实现了ellipsis，但是还是需要注意以下这些问题：<br />
1.经过XUL处理过的文本你将不能被选中，按理说-moz-user-select: text; 属性将允许文本被选中，但是我没有试验成功。<br />
2.如果你给父元素绑定了XUL，那么子元素的内容将变得不可见。例如：</p>
<p class="example xul ellipsis-1">It is a long<em>haha</em> long long long long text!</p>
<p>如果你只是给p节点绑定了XUL，那么在Firefox下你将看不到<em>haha</em>这个内容。<br />
它的源代码实际上是：</p>

<div class="wp_syntax"><div class="code"><pre class="div" style="font-family:monospace;"><span style="color: #44aa44;">&lt;</span>p<span style="color: #44aa44;">&gt;</span>It is a long<span style="color: #44aa44;">&lt;</span>em<span style="color: #44aa44;">&gt;</span> haha<span style="color: #44aa44;">&lt;/</span>em<span style="color: #44aa44;">&gt;</span> long long long long text<span style="color: #44aa44;">!&lt;/</span>p<span style="color: #44aa44;">&gt;</span></pre></div></div>

<p>参考资料:</p>
<p>http://www.w3.org/TR/2003/CR-css3-text-20030514/</p>
<p>http://www.quirksmode.org/css/contents.html</p>
<p>https://bugzilla.mozilla.org/show_bug.cgi?id=312156</p>
<p>https://developer.mozilla.org/En/XUL</p>
<p>https://developer.mozilla.org/En/XUL/Description</p>
<p>http://www.rikkertkoppes.com/thoughts/2008/6/</p>
<p>http://www.w3.org/TR/xbl/</p>
<p>http://www.w3.org/TR/css3-text/</p>
<h4 class="part-title">2.Javascript方式</h4>
<p>既然XUL无法完美解决Firefox下文字溢出显示&#8230;，那么我们就求助javascript吧，当然，并不是古老的截取一定数目的字符来实现。<br />
这里以jQuery为例，代码如下：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">ellipsis</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>enableUpdating<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> s <span style="color: #339933;">=</span> document.<span style="color: #660066;">documentElement</span>.<span style="color: #660066;">style</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'textOverflow'</span> <span style="color: #000066; font-weight: bold;">in</span> s <span style="color: #339933;">||</span> <span style="color: #3366CC;">'OTextOverflow'</span> <span style="color: #000066; font-weight: bold;">in</span> s<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #003366; font-weight: bold;">var</span> el <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>el.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;overflow&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;hidden&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					<span style="color: #003366; font-weight: bold;">var</span> originalText <span style="color: #339933;">=</span> el.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #003366; font-weight: bold;">var</span> w <span style="color: #339933;">=</span> el.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #003366; font-weight: bold;">var</span> t <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">cloneNode</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
                        <span style="color: #3366CC;">'position'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'absolute'</span><span style="color: #339933;">,</span>
                        <span style="color: #3366CC;">'width'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'auto'</span><span style="color: #339933;">,</span>
                        <span style="color: #3366CC;">'overflow'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'visible'</span><span style="color: #339933;">,</span>
                        <span style="color: #3366CC;">'max-width'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'inherit'</span>
                    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					el.<span style="color: #660066;">after</span><span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #003366; font-weight: bold;">var</span> text <span style="color: #339933;">=</span> originalText<span style="color: #339933;">;</span>
					<span style="color: #000066; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>text.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> t.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> el.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
						text <span style="color: #339933;">=</span> text.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> text.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						t.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>text <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
					el.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>t.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
					t.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>enableUpdating <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
						<span style="color: #003366; font-weight: bold;">var</span> oldW <span style="color: #339933;">=</span> el.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						setInterval<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
							<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>el.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> oldW<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
								oldW <span style="color: #339933;">=</span> el.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
								el.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>originalText<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
								el.<span style="color: #660066;">ellipsis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
							<span style="color: #009900;">&#125;</span>
						<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>这段js的原理很简单，就是通过不断的比较宽度值，然后逐个缩短字符宽度，当最后宽度合适的时候，停止循环，就实现了文字溢出显示&#8230;的效果。<br />
这段js还需要一段css来配合。</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.overflow</span> <span style="color: #00AA00;">&#123;</span>
	text-<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> ellipsis<span style="color: #00AA00;">;</span>
	-o-text-<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> ellipsis<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">nowrap</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>js里有个判断就是当样式里出现text-overflow或者-o-text-overflow的时候，便不会执行这段js。因为支持这两个属性的浏览器可以自己实现ellipsis效果。</p>
<p>这两种方法都可以实现Firefox下ellipsis的效果，如何取舍使用，具体还得根据你要运用到的项目的具体情况来具体分析，XUL实现的方法的不足之处在以上已经很详尽地列举了，如果你可以避免或者说这些无关你项目的大问题，那么XUL不失一个好方法。</p>
<p>至于其他的一些方法你可能在网上也有看到，比如用:after伪类来实现等，个人不推荐，所以我这里也不细说了，如果你有更好的方法，也希望能与我分享，谢谢观看！</p>

<p>本文地址:<a href="http://leeiio.me/text-overflow-ellipsis/">http://leeiio.me/text-overflow-ellipsis/<a></p>截至您的阅读器抓取时已有评论<strong> 54 </strong>条,大家讨论的如此激烈,你为什么不过去瞧瞧?!<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li>年度曖昧文章</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/text-overflow-ellipsis/feed/</wfw:commentRss>
		<slash:comments>54</slash:comments>
		</item>
		<item>
		<title>一个生日杯具</title>
		<link>http://leeiio.me/a-birthday-cup/</link>
		<comments>http://leeiio.me/a-birthday-cup/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 16:38:43 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[平面設計]]></category>
		<category><![CDATA[混合，雜亂無章。]]></category>
		<category><![CDATA[生日杯具]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=2012</guid>
		<description><![CDATA[今天才发现神奇的通讯工具秋秋上的生日可以指定为农历，可你知道，我并不是一个生日控，过了一个就够了。 之前公司说要送我的生日杯具今天终于拿到手了，图案是我自行设计的。作为一个前端，于是代码控了一把，印了一堆网页代码上去。 总体来说效果还挺不错，第一次印杯子图案，颜色有点偏色，CMYK不适用于杯子印刷咩？ 设计稿 谢谢观赏！ PS:杯具的是农历年应该是丁卯年而不是一九八七年&#8230; 本文地址:http://leeiio.me/a-birthday-cup/截至您的阅读器抓取时已有评论 91 条,大家讨论的如此激烈,你为什么不过去瞧瞧?!©Copyright 2007-2009 Leeiio Chaos Made http://Leeiio.me本站更換RSS地址：http://feed.leeiio.me，麻煩大家更新下，謝謝！ 声明: 本站遵循 署名-非商业性使用-相同方式共享 3.0 共享协议. 转载请注明转自 Leeiio.me 年度曖昧文章]]></description>
			<content:encoded><![CDATA[<p><img src="http://pic.yupoo.com/guaniu/535099240b15/medium.jpg" alt="一个生日杯具" /><br />
今天才发现神奇的通讯工具秋秋上的生日可以指定为农历，可你知道，我并不是一个生日控，过了一个就够了。<br />
之前公司说要送我的生日杯具今天终于拿到手了，图案是我自行设计的。作为一个前端，于是代码控了一把，印了一堆网页代码上去。<br />
总体来说效果还挺不错，第一次印杯子图案，颜色有点偏色，CMYK不适用于杯子印刷咩？<br />
<span id="more-2012"></span><br />
<img src="http://pic.yupoo.com/guaniu/028849240b0d/medium.jpg" alt="一个生日杯具" /></p>
<p><img src="http://pic.yupoo.com/guaniu/961659240b22/medium.jpg" alt="一个生日杯具" /></p>
<p>设计稿<br />
<img src="http://pic.yupoo.com/guaniu/614599240b51/bln4a3zo.png" alt="一个生日杯具设计稿" /></p>
<p>谢谢观赏！</p>
<p>PS:杯具的是农历年应该是丁卯年而不是一九八七年&#8230;</p>

<p>本文地址:<a href="http://leeiio.me/a-birthday-cup/">http://leeiio.me/a-birthday-cup/<a></p>截至您的阅读器抓取时已有评论<strong> 91 </strong>条,大家讨论的如此激烈,你为什么不过去瞧瞧?!<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li>年度曖昧文章</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/a-birthday-cup/feed/</wfw:commentRss>
		<slash:comments>91</slash:comments>
		</item>
		<item>
		<title>2010 年 CSS 裸奔节 ！</title>
		<link>http://leeiio.me/2010-css-naked-day/</link>
		<comments>http://leeiio.me/2010-css-naked-day/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 02:06:12 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[(X)HTML/CSS/XML/XSL]]></category>
		<category><![CDATA[CSS 裸奔节]]></category>
		<category><![CDATA[CSS Naked Day]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=2013</guid>
		<description><![CDATA[由Dustin Diaz推动的CSS NAKED DAY今年没有按时举行，在其网站上也没有贴出任何的今年的时间，但是推动Web标准发展应该是每位业界人士的一份责任，因此世界各地的人都延续传统，和去年一样是4月9日，大家都纷纷脱去了自己网站的衣服(CSS)，裸奔。 具体细节大家可以查看我去年的文章《拥抱 CSS 裸奔节，用 JavaScript 强制脱衣》。当然方法有很多，你想怎么裸就怎么裸。 祝大家裸奔愉快！羞。 本文地址:http://leeiio.me/2010-css-naked-day/截至您的阅读器抓取时已有评论 18 条,欢迎您也过来留下您的意见 !©Copyright 2007-2009 Leeiio Chaos Made http://Leeiio.me本站更換RSS地址：http://feed.leeiio.me，麻煩大家更新下，謝謝！ 声明: 本站遵循 署名-非商业性使用-相同方式共享 3.0 共享协议. 转载请注明转自 Leeiio.me 拥抱 CSS 裸奔节，用 JavaScript 强制脱衣 (26)]]></description>
			<content:encoded><![CDATA[<p><img src="http://imgs.leeiio.me/blogimgs/2009/04/20090409_cssnake.jpg" alt="2010 年 CSS 裸奔节" /><br />
由<a href="http://naked.dustindiaz.com/" rel="nofollow">Dustin Diaz</a>推动的CSS NAKED DAY今年没有按时举行，在其网站上也没有贴出任何的今年的时间，但是推动Web标准发展应该是每位业界人士的一份责任，因此世界各地的人都延续传统，和去年一样是4月9日，大家都纷纷脱去了自己网站的衣服(CSS)，裸奔。</p>
<p>具体细节大家可以查看我去年的文章<a href="http://leeiio.me/force-remove-css-in-css-nake-day/">《拥抱 CSS 裸奔节，用 JavaScript 强制脱衣》</a>。当然方法有很多，你想怎么裸就怎么裸。</p>
<p><strong>祝大家裸奔愉快！羞。</strong></p>

<p>本文地址:<a href="http://leeiio.me/2010-css-naked-day/">http://leeiio.me/2010-css-naked-day/<a></p>截至您的阅读器抓取时已有评论<strong> 18 </strong>条,欢迎您也过来留下您的意见 !<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li><a href="http://leeiio.me/force-remove-css-in-css-nake-day/" title="拥抱 CSS 裸奔节，用 JavaScript 强制脱衣">拥抱 CSS 裸奔节，用 JavaScript 强制脱衣</a> (26)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/2010-css-naked-day/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>消失的CSS3 box-shadow 属性?</title>
		<link>http://leeiio.me/css3-box-shadow-removed/</link>
		<comments>http://leeiio.me/css3-box-shadow-removed/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 06:26:17 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[(X)HTML/CSS/XML/XSL]]></category>
		<category><![CDATA[box-shadow]]></category>
		<category><![CDATA[css3]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=1987</guid>
		<description><![CDATA[如果你在疑惑为什么标题后面是个问号，因为我也不确定具体这个box-shadow属性是否消失后就不再回来了。发生了什么事？其实就是最近在看W3C关于css3的20091217文档的时候发现box-shadow属性已经没有任何说明了，只留下这么一段话： This module previously defined a ‘box-shadow’ property. This feature has been removed from this module for further discussion, and should reappear in another CSS module (or a later version of this module) in the near future. 以前这个模块定义了一个‘box-shadow’属性。这个特性目前已从这个模块中移除以做进一步的讨论，并将会出现在别的 CSS 模块中(或者更高版本的此模块)在不久的将来。 你知道，在css3中box-shadow是一个非常好玩的属性，被用得最广泛的地方莫过于:focus后的input或者textarea，诸如本站的input和留言区域的textarea，你会发现在:focus的状态时是加了box-shadow属性的。如图： 未激活状态的textarea 激活状态的textarea 当然在没看W3C的文档之前，我在别人的blog里看到的对于box-shadow的介绍发现内容都十分的陈旧了，大部分的对于shadow的定义都只是inset &#124;&#124; [ &#60;length> &#60;length> &#60;length>? &#124;&#124; &#60;color> ]而实际上其实是inset &#124;&#124; [ &#60;length> [...]]]></description>
			<content:encoded><![CDATA[<p>如果你在疑惑为什么标题后面是个问号，因为我也不确定具体这个box-shadow属性是否消失后就不再回来了。发生了什么事？其实就是最近在看<a href="http://www.w3.org/TR/css3-background/#the-box-shadow" rel="nofollow">W3C关于css3的20091217文档</a>的时候发现box-shadow属性已经没有任何说明了，只留下这么一段话：</p>
<blockquote><p>
This module previously defined a ‘box-shadow’ property. This feature has been removed from this module for further discussion, and should reappear in another CSS module (or a later version of this module) in the near future.<br />
以前这个模块定义了一个‘box-shadow’属性。这个特性目前已从这个模块中移除以做进一步的讨论，并将会出现在别的 CSS 模块中(或者更高版本的此模块)在不久的将来。
</p></blockquote>
<p>你知道，在css3中box-shadow是一个非常好玩的属性，被用得最广泛的地方莫过于:focus后的input或者textarea，诸如本站的input和留言区域的textarea，你会发现在:focus的状态时是加了box-shadow属性的。如图：<br />
<em>未激活状态的textarea</em><br />
<img src="http://imgs.leeiio.me/blogimgs/2010/04/20100404_box-shadow1.png" alt="消失的CSS3 box-shadow 属性" /><br />
<em>激活状态的textarea</em><br />
<img src="http://imgs.leeiio.me/blogimgs/2010/04/20100404_box-shadow2.png" alt="消失的CSS3 box-shadow 属性" /><br />
<span id="more-1987"></span><br />
当然在没看W3C的文档之前，我在别人的blog里看到的对于box-shadow的介绍发现内容都十分的陈旧了，大部分的对于shadow的定义都只是inset || [ &lt;length> &lt;length> &lt;length>?  || &lt;color> ]而实际上其实是inset || [ &lt;length> &lt;length> &lt;length>? &lt;length>? || &lt;color> ]。也就是有四个length可以定义。</p>
<p>在box-shadow没被移除前的最近一个CSS3草案文档(<a href="http://www.w3.org/TR/2008/WD-css3-background-20080910/#the-box-shadow" rel="nofollow">http://www.w3.org/TR/2008/WD-css3-background-20080910/#the-box-shadow</a>)中是这样定义的：</p>
<p><code>none | &lt;shadow> [ &lt;shadow> ]*</code></p>
<p>这里<shadow>被定义为：</p>
<p><code>&lt;shadow> = inset? &#038;&#038; [ &lt;length>{2,4} &#038;&#038; &lt;color>? ]</code></p>
<p>前面两个length长度取值对应着阴影在水平和竖直方向的位移。第三个length长度取值是模糊半径。第四个length长度取值是传播半径，使用正数表示阴影扩大，使用负数表示影子缩小，而这个长度是相对于父元素的大小而言的。<br />
而inset就是把原本投射在box外部的阴影投射到box里面而实现的内阴影，用过一些作图软件的对于内阴影应该不陌生吧。</p>
<p>box-shadow属性在不支持的浏览器上会优雅的降级。例如，在微软IE8以下浏览器上看起来都是平淡无奇的盒子而没有任何阴影效果。</p>
<p>当然前文介绍的<a href="http://leeiio.me/css3-generator-tools/">《两个 CSS3样式可视化生成工具：CSS3 Please &#038; CSS3 Generator》</a>可以帮你更直观的理解box-shadow这个属性。</p>
<p>如果你希望更多的了解这个目前已经被W3C移除的属性，可以继续阅读以下列表的文章：</p>
<ul>
<li><a href="http://fredericiana.com/2009/06/12/shadow-boxing-with-moz-box-shadow/" rel="nofollow">http://fredericiana.com/2009/06/12/shadow-boxing-with-moz-box-shadow/</a></li>
<li><a href="https://developer.mozilla.org/en/CSS/-moz-box-shadow" rel="nofollow">https://developer.mozilla.org/en/CSS/-moz-box-shadow</a></li>
<li><a href="http://www.w3.org/TR/2008/WD-css3-background-20080910/#the-box-shadow" rel="nofollow">http://www.w3.org/TR/2008/WD-css3-background-20080910/#the-box-shadow</a></li>
</ul>
<p>不知道何时，W3C才会发布正式版的CSS3啊&#8230;</p>
<p class="preview left"><a href="http://leeiio.me/demo/6-box-shadow-inset/" title="查看演示">View Demo
<em title="CSS3 box-shadow 属性演示">CSS3 box-shadow Demo</em></a></p><br />
<p class="clear"></p>

<p>本文地址:<a href="http://leeiio.me/css3-box-shadow-removed/">http://leeiio.me/css3-box-shadow-removed/<a></p>截至您的阅读器抓取时已有评论<strong> 12 </strong>条,欢迎您也过来留下您的意见 !<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li><a href="http://leeiio.me/css3-generator-tools/" title="两个CSS3样式可视化生成工具：CSS3 Please &#038; CSS3 Generator">两个CSS3样式可视化生成工具：CSS3 Please &#038; CSS3 Generator</a> (12)</li><li><a href="http://leeiio.me/css-hack-for-firefox-opera-safari-ie/" title="浏览器专属 CSS Hack:区分 Firefox / Opera / Safari / Internet Explorer">浏览器专属 CSS Hack:区分 Firefox / Opera / Safari / Internet Explorer</a> (28)</li><li><a href="http://leeiio.me/css-modify-selection-color-css3/" title="CSS 改变选取文字的颜色(CSS3 &#8211; 目前 Firefox/Safari only)">CSS 改变选取文字的颜色(CSS3 &#8211; 目前 Firefox/Safari only)</a> (14)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/css3-box-shadow-removed/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>两个CSS3样式可视化生成工具：CSS3 Please &amp; CSS3 Generator</title>
		<link>http://leeiio.me/css3-generator-tools/</link>
		<comments>http://leeiio.me/css3-generator-tools/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 14:54:18 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[設計資源]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[CSS3 Generator]]></category>
		<category><![CDATA[CSS3 Please]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=1972</guid>
		<description><![CDATA[CSS3随着浏览器的升级已经被越来越广泛的运用，合理的运用CSS3可以使你的网站更加美观，并且之前只能用js才能实现的效果也已经可以直接用CSS3来实现。但是虽然如此，很多浏览器对CSS3的支持还都是通过其私有属性来达到支持的，鲜有直接对W3C的标准来实现的。诸如firefox的-moz-和webkit的-webkit-属性前缀。 不过CSS3本身W3C也并未有正式版发布，现在还只是草案。下面我推荐两个很直观的，可视化的，自动生成CSS3样式代码的工具网站给大家。 1.CSS3 Generator 选择自己想要的CSS3属性，然后填写数值，右边便可直观的展示出效果了，然后你复制生成的样式代码即可。并且还列出了兼容这些样式的浏览器。可谓十分的方便。 http://www.css3generator.com/ 2.CSS3, please! 这个看起来就更加的直观了，就像做填空题一样，在网页上填写相应的数值，右上角的元素就会呈现出相应的样式。如果你不需要组合这么多效果的话，关闭掉某一些样式属性即可。可以点击“{toggle rule on} ”或者“{toggle rule off} ”来开启单项属性或者关闭。 http://css3please.com/ 正如前面所说，CSS3目前还是个草案，并且因为浏览器的关系，目前只有非主流浏览器支持，你知道的，所谓的主流浏览器就是占据了半壁多江山的IE系列了。IE系列目前只有IE8支持很少一部分的CSS3，未来的IE9倒是或许值得期待。 CSS3组合的好用的恰当确实可以使页面显示的很美观，可是如果只是为了CSS3而CSS3，诸如乱用text-shadow只是为了文字阴影而阴影个人觉得使完全没有必要的。 祝大家CSS3使用愉快。呃。 本文地址:http://leeiio.me/css3-generator-tools/截至您的阅读器抓取时已有评论 12 条,欢迎您也过来留下您的意见 !©Copyright 2007-2009 Leeiio Chaos Made http://Leeiio.me本站更換RSS地址：http://feed.leeiio.me，麻煩大家更新下，謝謝！ 声明: 本站遵循 署名-非商业性使用-相同方式共享 3.0 共享协议. 转载请注明转自 Leeiio.me 消失的CSS3 box-shadow 属性? (12)浏览器专属 CSS Hack:区分 Firefox / Opera / Safari / Internet Explorer (28)CSS 改变选取文字的颜色(CSS3 &#8211; 目前 Firefox/Safari only) [...]]]></description>
			<content:encoded><![CDATA[<p>CSS3随着浏览器的升级已经被越来越广泛的运用，合理的运用CSS3可以使你的网站更加美观，并且之前只能用js才能实现的效果也已经可以直接用CSS3来实现。但是虽然如此，很多浏览器对CSS3的支持还都是通过其私有属性来达到支持的，鲜有直接对W3C的标准来实现的。诸如firefox的-moz-和webkit的-webkit-属性前缀。</p>
<p>不过CSS3本身W3C也并未有正式版发布，现在还只是草案。下面我推荐两个很直观的，可视化的，自动生成CSS3样式代码的工具网站给大家。</p>
<p><strong>1.CSS3 Generator</strong><br />
<img src="http://imgs.leeiio.me/blogimgs/2010/04/20100401_css3generator.png" alt="CSS3 Generator" /><br />
选择自己想要的CSS3属性，然后填写数值，右边便可直观的展示出效果了，然后你复制生成的样式代码即可。并且还列出了兼容这些样式的浏览器。可谓十分的方便。<br />
<a href="http://www.css3generator.com/" rel="nofollow">http://www.css3generator.com/</a><br />
<span id="more-1972"></span><br />
<strong>2.CSS3, please! </strong><br />
<img src="http://imgs.leeiio.me/blogimgs/2010/04/20100401_css3please.png" alt="CSS3, please! " /><br />
这个看起来就更加的直观了，就像做填空题一样，在网页上填写相应的数值，右上角的元素就会呈现出相应的样式。如果你不需要组合这么多效果的话，关闭掉某一些样式属性即可。可以点击“{toggle rule on} ”或者“{toggle rule off} ”来开启单项属性或者关闭。<br />
<a href="http://css3please.com/" rel="nofollow">http://css3please.com/</a></p>
<p>正如前面所说，CSS3目前还是个草案，并且因为浏览器的关系，目前只有非主流浏览器支持，你知道的，所谓的主流浏览器就是占据了半壁多江山的IE系列了。IE系列目前只有IE8支持很少一部分的CSS3，未来的IE9倒是或许值得期待。</p>
<p>CSS3组合的好用的恰当确实可以使页面显示的很美观，可是如果只是为了CSS3而CSS3，诸如乱用text-shadow只是为了文字阴影而阴影个人觉得使完全没有必要的。</p>
<p>祝大家CSS3使用愉快。呃。</p>

<p>本文地址:<a href="http://leeiio.me/css3-generator-tools/">http://leeiio.me/css3-generator-tools/<a></p>截至您的阅读器抓取时已有评论<strong> 12 </strong>条,欢迎您也过来留下您的意见 !<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li><a href="http://leeiio.me/css3-box-shadow-removed/" title="消失的CSS3 box-shadow 属性?">消失的CSS3 box-shadow 属性?</a> (12)</li><li><a href="http://leeiio.me/css-hack-for-firefox-opera-safari-ie/" title="浏览器专属 CSS Hack:区分 Firefox / Opera / Safari / Internet Explorer">浏览器专属 CSS Hack:区分 Firefox / Opera / Safari / Internet Explorer</a> (28)</li><li><a href="http://leeiio.me/css-modify-selection-color-css3/" title="CSS 改变选取文字的颜色(CSS3 &#8211; 目前 Firefox/Safari only)">CSS 改变选取文字的颜色(CSS3 &#8211; 目前 Firefox/Safari only)</a> (14)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/css3-generator-tools/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>转换你的 Subversion 到 Git</title>
		<link>http://leeiio.me/convert-subversion-to-git/</link>
		<comments>http://leeiio.me/convert-subversion-to-git/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 13:08:11 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[設計資源]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=1943</guid>
		<description><![CDATA[当我发现我很感兴趣的项目都被其作者托管在Github的时候，让我萌生了对Git的好奇。虽然我已是如此的奥特曼，但是还是有必要写出来分享给其他还未接触 Git 的人的。之前我有介绍过《在Google Code上用 Mercurial 取代 Subversion 管理你的项目》，其实就是教大家如何把 SVN 转换到 Mercurial 且保留全部的历史记录。本文讲的则是另外一则，是教大家如何转换 SVN 到 Git，网上其实有不少的教程，但是都没有从 SVN 的 tags 到 Git 的 tags，本文提供了另外一则转换的指南，如果有不妥的地方，望请 Git 高手指教并指正。 1.安装 Git 首先，你需要安装带有 git-svn 的 Git(git-svn 可以让你 SVN 和 Git并用，如果你打算使用 Git 又不想转变你的 SVN版本库，这会是一种很好的解决方案，不过本文只是利用git-svn来一次性转换你的 SVN版本库 为 Git。) 你可以在这里下载安装Git：http://git-scm.com/download。最新版似乎都有集成git-svn，至少我安装完以上地址提供的编译好的版本，在 Terminal 里输入 git svn会有提示&#8221;Not a git repository&#8221;。 如果你正在使用MAC OS X，你应该已经用过 MacPorts了吧，那么： prompt&#62; sudo port [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://imgs.leeiio.me/blogimgs/2010/03/20100330_svntogit.png" alt="转换你的 Subversion 到 Git" /><br />
当我发现我很感兴趣的项目都被其作者托管在<a href="http://github.com" rel="nofollow">Github</a>的时候，让我萌生了对Git的好奇。虽然我已是如此的奥特曼，但是还是有必要写出来分享给其他还未接触 Git 的人的。之前我有介绍过<a href="http://leeiio.me/googlecode-converting-svn-to-hg/">《在Google Code上用 Mercurial 取代 Subversion 管理你的项目》</a>，其实就是教大家如何把 SVN 转换到 Mercurial 且保留全部的历史记录。本文讲的则是另外一则，是教大家如何转换 SVN 到 Git，网上其实有不少的教程，但是都没有从 SVN 的 tags 到 Git 的 tags，本文提供了另外一则转换的指南，如果有不妥的地方，望请 Git 高手指教并指正。<br />
<span id="more-1943"></span></p>
<h2 class="part-title">1.安装 Git</h2>
<p>首先，你需要安装带有 <a href="http://www.kernel.org/pub/software/scm/git/docs/git-svn.html" rel="nofollow">git-svn</a> 的 Git(git-svn 可以让你 SVN 和 Git并用，如果你打算使用 Git 又不想转变你的 SVN版本库，这会是一种很好的解决方案，不过本文只是利用git-svn来一次性转换你的 SVN版本库 为 Git。)</p>
<p>你可以在这里下载安装Git：<a href="http://git-scm.com/download" rel="nofollow">http://git-scm.com/download</a>。最新版似乎都有集成git-svn，至少我安装完以上地址提供的编译好的版本，在 Terminal 里输入 git svn会有提示&#8221;Not a git repository&#8221;。</p>
<p>如果你正在使用MAC OS X，你应该已经用过 MacPorts了吧，那么：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">prompt<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> git-core +<span style="color: #c20cb9; font-weight: bold;">svn</span></pre></div></div>

<p>Ubuntu 或者 Debian Linux用户:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">prompt<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> git-svn</pre></div></div>

<h2 class="part-title">2.创建作者文件</h2>
<p>下一步，创建一个文本文件来映射 Subversion 的提交者到 Git 的作者使历史记录里的名字和email地址正确显示。保存成authors.txt：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">guaniu = Leeiio &lt;xxx@xxx.com&gt;</pre></div></div>

<h2 class="part-title">3.克隆(clone)版本库</h2>
<p>现在来运行命令导入你的svn版本库为一个本地的Git版本库。<br />
我假定你的 svn 版本库有标准的 /trunk,/tags 以及/branches。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">prompt<span style="color: #000000; font-weight: bold;">&gt;</span> git <span style="color: #c20cb9; font-weight: bold;">svn</span> clone <span style="color: #000000; font-weight: bold;">&lt;</span>SVN版本库地址<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">--no-metadata</span> <span style="color: #660033;">-A</span> authors.txt <span style="color: #660033;">-t</span> tags <span style="color: #660033;">-b</span> branches <span style="color: #660033;">-T</span> trunk <span style="color: #000000; font-weight: bold;">&lt;</span>转换的目的目录名<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>比如以我的google code上的svn为例：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">prompt<span style="color: #000000; font-weight: bold;">&gt;</span> git <span style="color: #c20cb9; font-weight: bold;">svn</span> clone http:<span style="color: #000000; font-weight: bold;">//</span>leeiio.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">--no-metadata</span> <span style="color: #660033;">-A</span> authors.txt <span style="color: #660033;">-t</span> tags <span style="color: #660033;">-b</span> branches <span style="color: #660033;">-T</span> trunk Leeiio</pre></div></div>

<p>现在，你可以运行 git log 命令，你将会看到你全部的提交历史记录以及正确显示的提交者作者名。</p>
<h2 class="part-title">4.转换branches 为 tags</h2>
<p>现在还需要做一步处理。目前你全部的 tags 在 Git 的版本库里都成了 branches(分支)，并不是 tags。所以你需要手动转换它们。对于每一个 svn 的 tag你都将转换为 Git 的 tag，然后删除全部的 branch。用以下的命令列出：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">promp<span style="color: #000000; font-weight: bold;">&gt;</span> git branch <span style="color: #660033;">-r</span></pre></div></div>

<p>然后列出所有的tag：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">prompt<span style="color: #000000; font-weight: bold;">&gt;</span> git tag tagname tags<span style="color: #000000; font-weight: bold;">/</span>tagname
prompt<span style="color: #000000; font-weight: bold;">&gt;</span> git branch <span style="color: #660033;">-r</span> <span style="color: #660033;">-d</span> tags<span style="color: #000000; font-weight: bold;">/</span>tagname</pre></div></div>

<p>现在，你就有了一个本地的 Git 版本库了，包含了所有的历史记录以及 tags。</p>
<h2 class="part-title">5.Push(推送)到一个公共的版本库</h2>
<p>当然如果你并不想在网上分享你的 Git 版本库，这一步的操作你大可不必了。<br />
以 github 为例：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">prompt<span style="color: #000000; font-weight: bold;">&gt;</span> git remote add origin git<span style="color: #000000; font-weight: bold;">@</span>github.com:userid<span style="color: #000000; font-weight: bold;">/</span>project.git
prompt<span style="color: #000000; font-weight: bold;">&gt;</span> git push origin master <span style="color: #660033;">--tags</span></pre></div></div>

<p>Well Done!一切搞定了。开始你的 Git 之旅吧。</p>
<p>最后，附送一个为 SVN用户过渡到Git的<a href="http://git.or.cz/course/svn.html" rel="nofollow">使用手册</a>。</p>
<p>Via. <a href="http://pauldowman.com/2008/07/26/how-to-convert-from-subversion-to-git/" rel="nofollow">How to convert from Subversion to Git</a></p>

<p>本文地址:<a href="http://leeiio.me/convert-subversion-to-git/">http://leeiio.me/convert-subversion-to-git/<a></p>截至您的阅读器抓取时已有评论<strong> 9 </strong>条,欢迎您也过来留下您的意见 !<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li><a href="http://leeiio.me/bluehost-x86-64-subversion-svn/" title="在 Bluehost 主机上安装 Subversion(SVN),支持 64 位主机">在 Bluehost 主机上安装 Subversion(SVN),支持 64 位主机</a> (14)</li><li><a href="http://leeiio.me/googlecode-converting-svn-to-hg/" title="在Google Code上用 Mercurial 取代 Subversion 管理你的项目">在Google Code上用 Mercurial 取代 Subversion 管理你的项目</a> (11)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/convert-subversion-to-git/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>在Google Code上用 Mercurial 取代 Subversion 管理你的项目</title>
		<link>http://leeiio.me/googlecode-converting-svn-to-hg/</link>
		<comments>http://leeiio.me/googlecode-converting-svn-to-hg/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 08:20:39 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[設計資源]]></category>
		<category><![CDATA[Google Code]]></category>
		<category><![CDATA[Hg]]></category>
		<category><![CDATA[Mercurial]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=1903</guid>
		<description><![CDATA[之前，我一直都是用的SVN作为我日常的版本控制工具，诸如代码啊文档啊之类的东西。至于CVS这么复古的版本控制工具更是没有机会去尝试。说到SVN控制版本的话，作为托管服务商比较好的就有google code，本人也一直在使用。最近，由于一些项目的原因，了解到了另外一个版本控制工具Hg，当然Hg不是它的原名，原名叫Mercurial，都是水银的意思，所以通常称呼为Hg。 与集中式版本控制工具SVN不同的是，Hg是一种分布式版本控制工具。除了Hg，还有大名鼎鼎的Git也是分布式版本控制工具。想要更具体的了解版本控制工具的，推荐阅读胡凯《为什么我们要放弃Subversion》， 风云《分 布式的版本控制工具》，猛禽《分 布式版本控制（一）》 《分 布式版本控制（二） 》，Sparkle《我 与Mercurial 系列等几篇文章》等。只是想了解Mercurial(Hg)的话，Mercurial官方wiki已经有很详尽的资料和帮助文档了。 接下来回到本文的正题。本文的起因是Google Code在早前除了支持SVN托管代码外，更支持了分布式版本控制Mercurial(Hg)来管理你托管在Google Code上的项目。至于Google为什么在这么多种的分布式版本控制工具中选择了Mercurial而不是Git，这里有一篇文章，推荐阅读一下《Git 與 Mercurial 的分析》，原文《Analysis of Git and Mercurial》。 下面，就教大家怎么让Google Code用Mercurial替代Subversion来管理你的项目。原文 http://code.google.com/p/support/wiki/ConvertingSvnToHg。 在Google Code里设置由Mercurial来管理项目 访问你已经存在的google code项目页面，选择 “Administer” 选项页,然后选择下级分类选项页 “Source”。 改变第一项Repository type为Mercurial。 参照下文介绍的“如何转换Google Code里Subversion的历史记录到Mercurial中”，导入你的代码到 Hg 代码库中 以同样的导入代码的方式，导入你的wiki到Hg wiki库中。确认你使用的subversion代码库的wiki路径(例如 http://projectname.googlecode.com/svn/wiki) 以及 Hg 代码库的wiki路径(http://wiki.projectname.googlecode.com/hg/) 在你切换你的项目使用Mercurial管理后，你的旧Subversion项目仍然可以访问，所以在你切换之前你不需要备份你的代码库。你的Subversion版本库将会保持访问: https://projectname.googlecode.com/svn/ 如何转换Google Code里Subversion的历史记录到Mercurial中 第一种方式：简要截取 如果你不在乎你原来项目的历史记录，那么你可以简单地从Subversion里的主干代码或者wiki中提取最新的代码然后放到你的Mercurial中。假设你googlecode里的 Mercurial代码库是空的，那么可以这样操作： $ hg clone https://projectname.googlecode.com/hg hg-client [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://imgs.leeiio.me/blogimgs/2010/03/20100312_googlecode-converting-svn-to-hg.png" alt="在Google Code上用 Mercurial 取代 Subversion 管理你的项目" /><br />
之前，我一直都是用的SVN作为我日常的版本控制工具，诸如代码啊文档啊之类的东西。至于<a rel="nofollow" href="http://zh.wikipedia.org/zh-cn/協作版本系統">CVS</a>这么复古的版本控制工具更是没有机会去尝试。说到SVN控制版本的话，作为托管服务商比较好的就有google code，本人也一直在使用。最近，由于一些项目的原因，了解到了另外一个版本控制工具Hg，当然Hg不是它的原名，原名叫<a rel="nofollow" href="http://mercurial.selenic.com/">Mercurial</a>，都是水银的意思，所以通常称呼为Hg。<br />
<span id="more-1903"></span><br />
与集中式版本控制工具SVN不同的是，Hg是一种分布式版本控制工具。除了Hg，还有大名鼎鼎的<a rel="nofollow" href="http://git-scm.com/">Git</a>也是分布式版本控制工具。想要更具体的了解版本控制工具的，推荐阅读胡凯《<a href="http://www.infoq.com/cn/articles/thoughtworks-practice-partiv" rel="nofollow">为什么我们要放弃Subversion</a>》，<br />
风云《<a href="http://blog.codingnow.com/2008/01/distributed_version_control.html" rel="nofollow">分 布式的版本控制工具</a>》，猛禽《<a href="http://blog.csdn.net/Raptor/archive/2008/02/29/2133797.aspx" rel="nofollow">分 布式版本控制（一）</a>》 《<a href="http://blog.csdn.net/Raptor/archive/2008/03/04/2145492.aspx" rel="nofollow">分 布式版本控制（二） </a>》，Sparkle《<a href="http://weavesky.com/2008/01/25/mercurial-and-me/" rel="nofollow" class="broken_link">我 与Mercurial 系列等几篇文章</a>》等。只是想了解Mercurial(Hg)的话，<a href="http://mercurial.selenic.com/wiki/" rel="nofollow">Mercurial官方wiki</a>已经有很详尽的资料和帮助文档了。</p>
<p>接下来回到本文的正题。本文的起因是Google Code在早前除了支持SVN托管代码外，更支持了分布式版本控制Mercurial(Hg)来管理你托管在Google Code上的项目。至于Google为什么在这么多种的分布式版本控制工具中选择了Mercurial而不是Git，这里有一篇文章，推荐阅读一下<a rel="nofollow" href="http://blog.twpug.org/416" rel="nofollow">《Git 與 Mercurial 的分析》</a>，原文<a href="http://code.google.com/p/support/wiki/DVCSAnalysis" rel="nofollow">《Analysis of Git and Mercurial》</a>。</p>
<p><strong>下面，就教大家怎么让Google Code用Mercurial替代Subversion来管理你的项目。</strong>原文 http://code.google.com/p/support/wiki/ConvertingSvnToHg。</p>
<h2 class="part-title">在Google Code里设置由Mercurial来管理项目</h2>
<ol>
<li>访问你已经存在的google code项目页面，选择 “Administer” 选项页,然后选择下级分类选项页 “Source”。 </li>
<li>改变第一项Repository type为Mercurial。</li>
<li>参照下文介绍的“如何转换Google Code里Subversion的历史记录到Mercurial中”，导入你的代码到 Hg 代码库中 </li>
<li>以同样的导入代码的方式，导入你的wiki到Hg wiki库中。确认你使用的subversion代码库的wiki路径(例如 http://projectname.googlecode.com/svn/wiki) 以及 Hg 代码库的wiki路径(http://wiki.projectname.googlecode.com/hg/) </li>
</ol>
<p>在你切换你的项目使用Mercurial管理后，你的旧Subversion项目仍然可以访问，所以在你切换之前你不需要备份你的代码库。你的Subversion版本库将会保持访问: https://projectname.googlecode.com/svn/</p>
<h2 class="part-title">如何转换Google Code里Subversion的历史记录到Mercurial中</h2>
<p><strong>第一种方式：简要截取</strong><br />
如果你不在乎你原来项目的历史记录，那么你可以简单地从Subversion里的主干代码或者wiki中提取最新的代码然后放到你的Mercurial中。假设你googlecode里的 Mercurial代码库是空的，那么可以这样操作：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> $ hg clone https:<span style="color: #000000; font-weight: bold;">//</span>projectname.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>hg hg-client
 $ <span style="color: #7a0874; font-weight: bold;">cd</span> hg-client
 $ <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #660033;">--force</span> http:<span style="color: #000000; font-weight: bold;">//</span>projectname.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>trunk .
 $ hg add .
 $ hg commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Initial import of source.&quot;</span>
 $ hg push</pre></div></div>

<p>接着转换你的wiki：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> $ hg clone https:<span style="color: #000000; font-weight: bold;">//</span>wiki.projectname.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>hg hg-client-wiki
 $ <span style="color: #7a0874; font-weight: bold;">cd</span> hg-client-wiki
 $ <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #660033;">--force</span> http:<span style="color: #000000; font-weight: bold;">//</span>projectname.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>wiki .
 $ hg add .
 $ hg commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Initial import of wiki.&quot;</span>
 $ hg push</pre></div></div>

<p><strong>第二种方式：完整历史记录转换</strong><br />
如果你要迁移你整个的历史记录，整个过程可能要你更多的参与了。你将会需要先安装一些特殊的工具程序。<br />
<strong>安装工具</strong></p>
<ul>
<li>&#8216;hg convert&#8217;扩展模块。最新版本的Mercurial已经包含这个模块，请确保你的hg版本为1.1 或者 1.2 或者更高版本。 (可用&#8221;hg &#8211;version&#8221;命令查看) 然后在你的.hgrc里面添加如下代码启用该扩展模块:

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>extensions<span style="color: #009900;">&#93;</span>
hgext.<span style="color: #202020;">convert</span><span style="color: #339933;">=</span></pre></div></div>

</li>
<li>Subversion的swig-python绑定。请确保您有最近的Subversion安装（1.5或1.6）。绝大部分的Subversion衍生版本都有与python的绑定，或者提供他们额外的二进制包。你可以运行如下代码检查你的svn &#8211; python的绑定是否正常：

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ python <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;import svn.core; print svn.core.SVN_VER_MINOR&quot;</span>
        <span style="color: #000000;">5</span></pre></div></div>

<p>如果失败，或返回的版本低于5，则肯定是不对的。如果你没有二进制软件包，你可以从Subversion自己的源代码树中建立：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> checkout http:<span style="color: #000000; font-weight: bold;">//</span>svn.collab.net<span style="color: #000000; font-weight: bold;">/</span>repos<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>tags<span style="color: #000000; font-weight: bold;">/</span>1.6.0 <span style="color: #c20cb9; font-weight: bold;">svn</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #c20cb9; font-weight: bold;">svn</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>autogen.sh <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> .<span style="color: #000000; font-weight: bold;">/</span>configure
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> swig-py  <span style="color: #666666; font-style: italic;"># make sure you have swig 1.3 installed already</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> check-swig-py
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> install-swig-py</pre></div></div>

<p>如果你在Ubuntu的Hardy版本，你可以在hardy-backports里找到1.5版的python-subversion: <a href="http://packages.ubuntu.com/hardy-backports/python-subversion" rel="nofollow">http://packages.ubuntu.com/hardy-backports/python-subversion</a><br />
这可能还需要安装backports里的libsvn1, subversion, mercurial-common, 和mercurial 包。
        </li>
</ul>
<p><strong>开始转换</strong><br />
现在我们开始转换&#8211; branches(分支), tags(标签)以及其他全部:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> hg-client
$ hg convert http:<span style="color: #000000; font-weight: bold;">//</span>projectname.googlecode.com<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svn</span> hg-client</pre></div></div>

<p>一旦完成转换，你就可以push你最新的历史记录到你的Google Code项目中(前提是你有了一个空的Mercurial版本库):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> hg-client
$ hg push https:<span style="color: #000000; font-weight: bold;">//</span>projectname.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>hg</pre></div></div>

<p>至此，大功告成。</p>

<p>本文地址:<a href="http://leeiio.me/googlecode-converting-svn-to-hg/">http://leeiio.me/googlecode-converting-svn-to-hg/<a></p>截至您的阅读器抓取时已有评论<strong> 11 </strong>条,欢迎您也过来留下您的意见 !<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li><a href="http://leeiio.me/convert-subversion-to-git/" title="转换你的 Subversion 到 Git">转换你的 Subversion 到 Git</a> (9)</li><li><a href="http://leeiio.me/bluehost-x86-64-subversion-svn/" title="在 Bluehost 主机上安装 Subversion(SVN),支持 64 位主机">在 Bluehost 主机上安装 Subversion(SVN),支持 64 位主机</a> (14)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/googlecode-converting-svn-to-hg/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>在Vim里玩Zen Coding</title>
		<link>http://leeiio.me/zen-coding-in-vim/</link>
		<comments>http://leeiio.me/zen-coding-in-vim/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 05:21:53 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[設計資源]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[Vim插件]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=1880</guid>
		<description><![CDATA[Zen Coding确实是一个很不错的快速写代码的方式，自@zen_coding发布以来，受到了不少前端人士的追捧和青睐。试想只要输入div#content>h1+p即可得到&#60;div id="content">&#60;h1>&#60;/h1>&#60;p>&#60;/p>&#60;/div>这么一段代码，无疑减少了很多次对键盘的敲击，省力省键盘。你想更多的了解Zen Coding可以戳此查看更详细的介绍。 Vim之前我有做过简单的介绍，与其说介绍，不如说是简单的折腾。而Zen Coding的官方项目地址Google Code上还木有Zen Coding的vim插件，倒是在VIM的主页上找到了VIM 的 Zen Coding 插件ZenCoding.vim。如果想跟进这个插件的版本的话，可以Github上找到这个VIM插件的的最新情况http://github.com/mattn/zencoding-vim。 ZenCoding.vim插件提供的默认展开代码的快捷键是,也就是Ctrl + y and Comma。例如输入html:5_(_为光标的位置)，然后输入“&#60;c-y>,”，就会展开成 &#60;!DOCTYPE HTML&#62; &#60;html lang=&#34;en&#34;&#62; &#60;head&#62; &#60;title&#62;&#60;/title&#62; &#60;meta charset=&#34;UTF-8&#34;&#62; &#60;/head&#62; &#60;body&#62; _ &#60;/body&#62; &#60;/html&#62; 输入div#foo$*2>div.bar，然后输入“&#60;c-y>,”就会展开成 &#60;div id=&#34;foo1&#34;&#62; &#60;div class=&#34;bar&#34;&#62;_&#60;/div&#62; &#60;/div&#62; &#60;div id=&#34;foo2&#34;&#62; &#60;div class=&#34;bar&#34;&#62;&#60;/div&#62; &#60;/div&#62; 当然，你也可以根据自己的习惯设置展开代码的快捷键，你可以通过在你的vimrc配置文件里写入以下配置来覆盖zencoding.vim插件的默认设置。 let g:user_zen_settings = &#123; \ 'indentation' : ' ', \ 'perl' : &#123; [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://imgs.leeiio.me/blogimgs/2010/03/20100308-vimzencoding.png" alt="Zen coding in vim" /><br />
Zen Coding确实是一个很不错的快速写代码的方式，自<a rel="nofollow" href="https://twitter.com/zen_coding">@zen_coding</a>发布以来，受到了不少前端人士的追捧和青睐。试想只要输入<code class="code-inline">div#content>h1+p</code>即可得到<code class="code-inline">&lt;div id="content">&lt;h1>&lt;/h1>&lt;p>&lt;/p>&lt;/div></code>这么一段代码，无疑减少了很多次对键盘的敲击，省力省键盘。你想更多的了解Zen Coding可以<a rel="nofollow" href="http://www.qianduan.net/zen-coding-a-new-way-to-write-html-code.html">戳此</a>查看更详细的介绍。<br />
<span id="more-1880"></span><br />
Vim之前我有做过<a href="http://leeiio.me/vim-novice/">简单的介绍</a>，与其说介绍，不如说是<a href="http://leeiio.me/vim-novice/">简单的折腾</a>。而Zen Coding的官方项目地址<a href="http://code.google.com/p/zen-coding/" rel="nofollow">Google Code</a>上还木有Zen Coding的vim插件，倒是在VIM的主页上找到了VIM 的 Zen Coding 插件<a rel="nofollow" href="http://www.vim.org/scripts/script.php?script_id=2981">ZenCoding.vim</a>。如果想跟进这个插件的版本的话，可以Github上找到这个VIM插件的的最新情况<a href="http://github.com/mattn/zencoding-vim" rel="nofollow">http://github.com/mattn/zencoding-vim</a>。</p>
<p>ZenCoding.vim插件提供的默认展开代码的快捷键是<c-y>,也就是Ctrl + y and Comma。例如输入<code class="code-inline">html:5_</code>(_为光标的位置)，然后输入“&lt;c-y>,”，就会展开成</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE HTML&gt;</span> 
 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span> 
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span> 
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">charset</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;UTF-8&quot;</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span> 
      _ 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>输入<code class="code-inline">div#foo$*2>div.bar</code>，然后输入“&lt;c-y>,”就会展开成</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;foo1&quot;</span>&gt;</span> 
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;bar&quot;</span>&gt;</span>_<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;foo2&quot;</span>&gt;</span> 
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;bar&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p><strong>当然，你也可以根据自己的习惯设置展开代码的快捷键，你可以通过在你的vimrc配置文件里写入以下配置来覆盖zencoding.vim插件的默认设置。</strong></p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #804040;">let</span> g<span style="color: #000000;">:</span>user_zen_settings = <span style="color: #000000;">&#123;</span> 
  \  <span style="color: #C5A22D;">'indentation'</span> <span style="color: #000000;">:</span> <span style="color: #C5A22D;">'  '</span>, 
  \  <span style="color: #C5A22D;">'perl'</span> <span style="color: #000000;">:</span> <span style="color: #000000;">&#123;</span> 
  \    <span style="color: #C5A22D;">'aliases'</span> <span style="color: #000000;">:</span> <span style="color: #000000;">&#123;</span> 
  \      <span style="color: #C5A22D;">'req'</span> <span style="color: #000000;">:</span> <span style="color: #C5A22D;">'require '</span> 
  \    <span style="color: #000000;">&#125;</span>, 
  \    <span style="color: #C5A22D;">'snippets'</span> <span style="color: #000000;">:</span> <span style="color: #000000;">&#123;</span> 
  \      <span style="color: #C5A22D;">'use'</span> <span style="color: #000000;">:</span> <span style="color: #C5A22D;">&quot;use strict<span style="">\n</span>use warnings<span style="">\n</span><span style="">\n</span>&quot;</span>, 
  \      <span style="color: #C5A22D;">'warn'</span> <span style="color: #000000;">:</span> <span style="color: #C5A22D;">&quot;warn <span style="">\&quot;</span>|<span style="">\&quot;</span>;&quot;</span>, 
  \    <span style="color: #000000;">&#125;</span> 
  \  <span style="color: #000000;">&#125;</span> 
  \<span style="color: #000000;">&#125;</span> 
&nbsp;
  <span style="color: #804040;">let</span> g<span style="color: #000000;">:</span>user_zen_expandabbr_key = <span style="color: #C5A22D;">'&lt;c-e&gt;'</span>    <span style="color: #C5A22D;">&quot;设置为ctrl+e展开
&nbsp;
  let g:use_zen_complete_tag = 1</span></pre></div></div>

<p><strong>截图中的例子：</strong><br />
如果你在这段文本外面包裹这段缩写<code class="code-inline">div#header>ul#navigation>li.item$*>a>span:</code></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">About Us
Products
News
Blog
Contact Up</pre></div></div>

<p>你将会得到以下结果：</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;header&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;navigation&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;item1&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>About Us<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;item2&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>Products<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;item3&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>News<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;item4&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>Blog<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;item5&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>Contact Up<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>目前就目前我对zencoding.vim 0.27版的测试来说，选中文字用<code class="code-inline">div#header>ul#navigation>li.item$*>a>span</code>包括的时候出现了文本内容插入到错误的位置的问题，提交bug给作者了。<br />
<strong>2010/03/08 22:11</strong> 更新：作者回复说修复了。在0.28版本中增加了更多的快捷键操作，所以下面的自定义快捷键配置无法生效了。可前往http://github.com/mattn/zencoding-vim获取最新版本。<br />
<strong>2010/03/09 20:05</strong> 更新：经过和作者的探讨，原来的<c-z>快捷键已经改为<c-y>，不会和撤销冲突，另外上条更新所说的自定义快捷键重新可用了。</p>
<p>zencoding.vim更新十分频繁，大家可以关注下。<br />
VIM官方插件地址：<a rel="nofollow" href="http://www.vim.org/scripts/script.php?script_id=2981">ZenCoding.vim</a><br />
zencoding.vim在Github的地址：<a href="http://github.com/mattn/zencoding-vim" rel="nofollow">http://github.com/mattn/zencoding-vim</a><br />
Zen Coding官方地址：<a rel="nofollow" href="http://code.google.com/p/zen-coding/">http://code.google.com/p/zen-coding/</a><br />
Zen Coding官方提供的速查手册(PDF)：<a rel="nofollow" href="http://zen-coding.googlecode.com/files/ZenCodingCheatSheet.pdf">http://zen-coding.googlecode.com/files/ZenCodingCheatSheet.pdf</a></p>

<p>本文地址:<a href="http://leeiio.me/zen-coding-in-vim/">http://leeiio.me/zen-coding-in-vim/<a></p>截至您的阅读器抓取时已有评论<strong> 25 </strong>条,欢迎您也过来留下您的意见 !<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li><a href="http://leeiio.me/vim-novice/" title="Vim 新手上路">Vim 新手上路</a> (56)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/zen-coding-in-vim/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Vim 新手上路</title>
		<link>http://leeiio.me/vim-novice/</link>
		<comments>http://leeiio.me/vim-novice/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 13:37:33 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[設計資源]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[新手上路]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=1858</guid>
		<description><![CDATA[之前一直用的文本编辑器事Notepad++，IDE是Aptana，前者轻便实用，后者十分强大，搭配使用更是没话说。当然还有很多强大的诸如IDEA等等。Vim这个强大的编辑器想不知道都难，可是一直没去尝试使用，总觉得配置好Vim是一件很复杂的事情，今天终于按捺不住那份渴望，尝试了一下，终于无法自拔。 虽然我很out了，但是我想还是有很多Vim初学者徘徊在门外，抱着窥一窥的态度。我也就作为一个菜鸟，谈谈我的上路之旅吧。 1.Vim安装 官网http://www.vim.org/download.php处下载适合的版本即可，因为我的公司工作平台是Win XP，所以我下的是GUI executable版本图形化界面的版本gvim72.zip。 2.多语言乱码问题 安装好之后，我想第一要解决的问题是编码问题。和所有的流行文本编辑器一样，Vim 可以很好的编辑各种字符编码的文件，这当然包括 UCS-2、UTF-8 等流行的 Unicode 编码方式。然而不幸的是，和很多来自 Linux 世界的软件一样，这需要你自己动手设置。一般的，vim打开中文文件时会出现乱码，原因比较复杂，这里不罗嗦了。就说说我的配置吧。Vim的配置问题存在于安装路径的根目录，比如我安装在D:\Program Files\Vim，_vimrc文件就是它的配置文件，以下所描述的配置信息皆写到这个文件里。 &#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34; &#34; =&#62; 配置多语言环境 &#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34;&#34; if has&#40;&#34;multi_byte&#34;&#41; set encoding=utf-8 set termencoding=utf-8 set formatoptions+=mM set fencs=utf-8,gbk &#160; if v:lang =~? '^\(zh\)\&#124;\(ja\)\&#124;\(ko\)' set ambiwidth=double endif &#160; if has&#40;&#34;win32&#34;&#41; &#34;处理菜单及右键菜单乱码 source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim source $VIMRUNTIME/mswin.vim behave mswin language messages zh_CN.utf-8 &#34;处理consle输出乱码 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://imgs.leeiio.me//blogimgs/2010/02/20100223_vimbird.png" alt="Vim 初探" /><br />
之前一直用的文本编辑器事Notepad++，IDE是Aptana，前者轻便实用，后者十分强大，搭配使用更是没话说。当然还有很多强大的诸如IDEA等等。Vim这个强大的编辑器想不知道都难，可是一直没去尝试使用，总觉得配置好Vim是一件很复杂的事情，今天终于按捺不住那份渴望，尝试了一下，终于无法自拔。 </p>
<p>虽然我很out了，但是我想还是有很多Vim初学者徘徊在门外，抱着窥一窥的态度。我也就作为一个菜鸟，谈谈我的上路之旅吧。<br />
<span id="more-1858"></span></p>
<h2 class="part-title">1.Vim安装</h2>
<p>官网http://www.vim.org/download.php处下载适合的版本即可，因为我的公司工作平台是Win XP，所以我下的是GUI executable版本图形化界面的版本gvim72.zip。 </p>
<h2 class="part-title">2.多语言乱码问题</h2>
<p>安装好之后，我想第一要解决的问题是编码问题。和所有的流行文本编辑器一样，<a href="http://leeiio.me/vim-novice/">Vim</a> 可以很好的编辑各种字符编码的文件，这当然包括 UCS-2、UTF-8 等流行的 Unicode 编码方式。然而不幸的是，和很多来自 Linux 世界的软件一样，这需要你自己动手设置。一般的，vim打开中文文件时会出现乱码，原因比较复杂，这里不罗嗦了。就说说我的配置吧。<a href="http://leeiio.me/vim-novice/">Vim</a>的配置问题存在于安装路径的根目录，比如我安装在D:\Program Files\Vim，_vimrc文件就是它的配置文件，以下所描述的配置信息皆写到这个文件里。</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;</span>
<span style="color: #adadad; font-style: italic;">&quot; =&gt; 配置多语言环境</span>
<span style="color: #adadad; font-style: italic;">&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;</span>
<span style="color: #804040;">if</span> <span style="color: #25BB4D;">has</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">&quot;multi_byte&quot;</span><span style="color: #000000;">&#41;</span>
    set encoding=utf<span style="color: #000000;">-</span><span style="color: #000000; font-weight:bold;">8</span>
    set termencoding=utf<span style="color: #000000;">-</span><span style="color: #000000; font-weight:bold;">8</span>
    set formatoptions<span style="color: #000000;">+</span>=mM
    set fencs=utf<span style="color: #000000;">-</span><span style="color: #000000; font-weight:bold;">8</span>,gbk
&nbsp;
    <span style="color: #804040;">if</span> v<span style="color: #000000;">:</span>lang =<span style="color: #000000;">~?</span> <span style="color: #C5A22D;">'^<span style="">\(</span>zh<span style="">\)</span><span style="">\|</span><span style="">\(</span>ja<span style="">\)</span><span style="">\|</span><span style="">\(</span>ko<span style="">\)</span>'</span>
        set ambiwidth=double
    <span style="color: #804040;">endif</span>
&nbsp;
    <span style="color: #804040;">if</span> <span style="color: #25BB4D;">has</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">&quot;win32&quot;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #C5A22D;">&quot;处理菜单及右键菜单乱码
        source $VIMRUNTIME/delmenu.vim
        source $VIMRUNTIME/menu.vim
        source $VIMRUNTIME/mswin.vim
        behave mswin
        language messages zh_CN.utf-8 &quot;</span>处理consle输出乱码
    <span style="color: #804040;">endif</span>
<span style="color: #804040;">else</span>
    <span style="color: #804040;">echoerr</span> <span style="color: #C5A22D;">&quot;Sorry, this version of (g)vim was not compiled with +multi_byte&quot;</span>
<span style="color: #804040;">endif</span></pre></div></div>

<p>Vim配置文件里面半角的&#8221;是注释。多语言环境编码的配置取自<a href="http://www.gracecode.com/archives/1780/">明城</a>的Vim的配置。</p>
<h2 class="part-title">3.字体的设置</h2>
<p>写代码，好看的字体很重要。不管是什么，好看的东西都很重要。好看，能带给人愉悦感，写代码也不例外。我用的是大名鼎鼎的Yahei Consolas Hybrid修改字体，中文字体是雅黑，代码字体么自然是Consolas。  Consolas字体原本是微软为 Visual Studio 2005和2008用户提供的，原版只是单独的英文字体，不含中文。因此在中文环境下显示会是“宋体”+Consolas 的组合，难看至极。而这个修改版替换了雅黑作为中文字体，美观度自然是宋体有所提高，当然也是因人而异。要下载字体可以<a href="http://rapidshare.com/files/116657698/YaHei.Consolas.1.12.zip.html" rel="nofollow">戳这里</a>下载。<br />
然后在配置里加入以下代码来指定字体</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">set guifont=YaHei_Consolas_Hybrid<span style="color: #000000;">:</span>h12<span style="color: #000000;">:</span>cANSI <span style="color: #C5A22D;">&quot;h12表示的是字号大小</span></pre></div></div>

<h2 class="part-title">3.配色方案</h2>
<p>在用notepad++的时候，我一直最中意monokai这个配色，在Vim下叫molokai，这是一款很知名的配色，至少我很喜欢，就是最顶端的那个截图里的配色啦。这款配色同样可以<a rel="nofollow" href="http://www.vim.org/scripts/script.php?script_id=2340">戳这里</a>获得。<br />
然后你可以在配置里写入以下代码来指定你的界面为该配色</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">colorscheme molokai</pre></div></div>

<h2 class="part-title">4.一些插件和扩展</h2>
<p>也许你同样注意到了截图中的那些花花绿绿背景色的东西，这个叫CSS color preview的扩展可以使css里面的那些颜色具体化也就是表现出来，十分直观。继续<a href="http://www.vim.org/scripts/script.php?script_id=2150">戳这里</a>下载。<br />
而代码提示插件用的是AutoComplPop，还在使用DW或者aptana等一些工具的朋友们肯定对代码弹出提示情有独钟，这款插件的功能可以说是有过之而无不及啊，当然如果你不喜欢这种自动的代码提示的话可以不用装。需要的朋友还是<a href="http://www.vim.org/scripts/script.php?script_id=1879" rel="nofollow">戳这里</a>下载。</p>
<p>Vim的强大之处当然不止本文说的这么些皮毛，丰富的扩展插件让其光芒不减。我还涉谷未深，这种新上上路的文章希望能给每个想加入Vim阵营的朋友们以帮助。今后会有更多的关于Vim的分享。欢迎收看！</p>

<p>本文地址:<a href="http://leeiio.me/vim-novice/">http://leeiio.me/vim-novice/<a></p>截至您的阅读器抓取时已有评论<strong> 56 </strong>条,大家讨论的如此激烈,你为什么不过去瞧瞧?!<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li><a href="http://leeiio.me/zen-coding-in-vim/" title="在Vim里玩Zen Coding">在Vim里玩Zen Coding</a> (25)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/vim-novice/feed/</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
		<item>
		<title>全世界最短的 JavaScript 判定 IE 浏览器！这个可以短！</title>
		<link>http://leeiio.me/ie_detection_in_5_bytes/</link>
		<comments>http://leeiio.me/ie_detection_in_5_bytes/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 17:50:17 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[JS/Ajax/AS/Flex]]></category>
		<category><![CDATA[IE判定]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://leeiio.me/?p=1818</guid>
		<description><![CDATA[有些东西你想让它长它并不一定就会如愿，但是有一些东西你想让它短也并不一定就会如愿，这两者都要看你的本事。对于我等IT民工来说，自然是代码写得越短越好。 你知道，IE是个脑残儿浏览器，不管是什么版本，纵使版本号越来越大，可总是让人觉得这玩意儿跟标准老是扯不上暧昧。可是，你知道，只要世上还有 windows 操作系统，IE就永生不灭，阿门。对于代码工作者来说，自然是苦不堪言，为了考虑IE的兼容问题，不管是写 CSS 还是 JS，往往都要对 IE 特别对待，这就少不了做些判断。本文不讨论如何区分 IE 的样式，仅是 JS 判定 IE 浏览器。 这个目前世界上最短的 Javascript 判定 IE 浏览器的方法来自一个俄人,又是俄人！它已经在各版本的 IE 以及目前其他流行的浏览器上经过测试，基于 IE 的 Bug，微软虽然已经意识到，但是从来没有纠正过。 &#60;script type='text/javascript'&#62; var ie = !-&#91;1,&#93;; alert&#40;ie&#41;; &#60;/script&#62; 以上代码运行结果：IE 下返回true，其他标准浏览器返回false。!-[1,]，仅仅只有 6 bytes！ 不过如果反过来判断，标准浏览器返回 true 而 IE 返回 false的话，则可以再缩短一个byte。 &#60;script type='text/javascript'&#62; notIe = -&#91;1,&#93;; &#160; if&#40;-&#91;1,&#93;&#41;&#123; // 标准浏览器代码 &#125;else&#123; // IE [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://imgs.leeiio.me/blogimgs/2010/01/20100131_theShortestDefinitionOfIE.jpg" alt="全世界最短的JavaScript判定IE浏览器！" /><br />
有些东西你想让它长它并不一定就会如愿，但是有一些东西你想让它短也并不一定就会如愿，这两者都要看你的本事。对于我等IT民工来说，自然是代码写得越短越好。</p>
<p>你知道，IE是个脑残儿浏览器，不管是什么版本，纵使版本号越来越大，可总是让人觉得这玩意儿跟标准老是扯不上暧昧。可是，你知道，只要世上还有 windows 操作系统，IE就永生不灭，阿门。对于代码工作者来说，自然是苦不堪言，为了考虑IE的兼容问题，不管是写 CSS 还是 JS，往往都要对 IE 特别对待，这就少不了做些判断。本文不讨论如何区分 IE 的样式，仅是 JS 判定 IE 浏览器。<br />
<span id="more-1818"></span><br />
这个目前世界上最短的 Javascript 判定 IE 浏览器的方法来自一个<a rel="nofollow" href="http://studioad.ru/blog/ie_detection_in_5_bytes/2010-01-08-103">俄人</a>,又是俄人！它已经在各版本的 IE 以及目前其他流行的浏览器上经过测试，基于 IE 的 Bug，微软虽然已经意识到，但是从来没有纠正过。</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">var</span> ie <span style="color: #339933;">=</span> <span style="color: #339933;">!-</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>ie<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>以上代码运行结果：IE 下返回true，其他标准浏览器返回false。!-[1,]，仅仅只有 6 bytes！</p>
<p>不过如果反过来判断，标准浏览器返回 true 而 IE 返回 false的话，则可以再缩短一个byte。</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">&gt;</span>
notIe <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">// 标准浏览器代码</span>
<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">// IE Only的代码</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p><strong>看完了这些，你们是不是很好奇这些是怎么运行的？请继续看下文。</strong></p>
<p>这个 Bug 产生的原因是 IE 会添加一个空数组元素到数组元素的总数里。</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #009900;">&#93;</span>. <span style="color: #660066;">Length</span></pre></div></div>

<p>标准浏览器会返回 1 (基于标准的 ECMAscript ，在数组最后的逗号&#8221;,&#8221;会被忽略，这是为了方便在一列里显示以及自动生成等)，但是 IE 会返回 2。当你打印这个数组的时候 IE 将会返回 &#8220;1, &#8220;，也就是两个元素，而其他标准浏览器将会返回 &#8220;1&#8243;。</p>
<p>这很容易验证，比如在 IE 和 FF中运行以下代码：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">&gt;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">','</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">//这是8个字符判定IE</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>[1,]实际上浏览器的操作是toString()转换成字符串的操作，-[1,]是将字符串强制转换为数字。而 IE 将会返回 NaN，但是遗憾的是 NaN 并不是一个数字，因为[1,]转换成字符串后的&#8221;1,&#8221;里面带有逗号。而其他标准浏览器会返回 -1，这是一个非 0 的数字。</p>
<p>你知道，NaN 转换成 Boolean 型将返回 false，所以-[1,]在 IE 下将返回 false。而任何非 0 的数字转换成 Boolean 型(例如-1)，在 标准浏览器下都将返回 true。所以我们得到了一个判定结果，!-[1,]在 IE 下返回true，而在其他标准浏览器下返回 false。也就达到了区分判定 IE 浏览器的目的。</p>
<p>当然，如前文所说，这个 Bug 其实微软很早就已经知道，但是却一直没有去修复它，所以在未来的 > IE8 的 IE 浏览器也就不确定是否依旧可以，不过基本上这么多代的 IE 都没有修复，未来的 IE 也不太会去修复的样子。</p>
<p><strong>以下是其他的一些区分判定 IE 浏览器的代码，也可以参考下:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">&gt;</span>
<span style="color: #006600; font-style: italic;">// Option from Dean Edwards:</span>
<span style="color: #003366; font-weight: bold;">var</span> ie <span style="color: #339933;">=</span> <span style="color: #006600; font-style: italic;">/*@cc_on!@*/</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Use the commented line:</span>
<span style="color: #003366; font-weight: bold;">var</span> ie<span style="color: #006600; font-style: italic;">//@cc_on=1;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Variation (shorter variable):</span>
<span style="color: #003366; font-weight: bold;">var</span> ie <span style="color: #339933;">=</span> <span style="color: #3366CC;">'<span style="color: #000099; font-weight: bold;">\v</span>'</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'v'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009966; font-style: italic;">/ /</span> Option to Gareth Hayes <span style="color: #009900;">&#40;</span>former record<span style="color: #339933;">-</span>holder<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>
<span style="color: #003366; font-weight: bold;">var</span> ie <span style="color: #339933;">=</span> <span style="color: #339933;">!+</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\v</span>1&quot;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span> script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>参考文章：<br />
<a href="http://studioad.ru/blog/ie_detection_in_5_bytes/2010-01-08-103" rel="nofollow">Самое короткое определение IE</a><br />
<a href="http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html" rel="nofollow">32 bytes, ehr &#8230; 9, ehr &#8230; 7!!! to know if your browser is IE</a></p>

<p>本文地址:<a href="http://leeiio.me/ie_detection_in_5_bytes/">http://leeiio.me/ie_detection_in_5_bytes/<a></p>截至您的阅读器抓取时已有评论<strong> 41 </strong>条,大家讨论的如此激烈,你为什么不过去瞧瞧?!<hr />©Copyright 2007-2009 Leeiio Chaos Made <a href="http://leeiio.me" target="_blank">http://Leeiio.me</a><br /><font style="font-size:15px;font-weight:bold">本站更換RSS地址：<a href="http://feed.leeiio.me" title="戳我訂閱最新rss地址"><font color="red">http://feed.leeiio.me</font></a>，麻煩大家更新下，謝謝！</font><br />
<p><strong>声明:</strong> 本站遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://leeiio.me">Leeiio.me</a>
<img src="http://img.tongji.linezing.com/990626/tongji.gif"/></p> <ul class="related_post"><li>年度曖昧文章</li></ul>]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/ie_detection_in_5_bytes/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
	</channel>
</rss>
