<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>《YAHOO.util.Dom.getElementsByClassName的一点小改进~》的评论</title>
	<atom:link href="http://www.12sui.cn/yui/yahoo-util-dom-getelementsbyclassname-improve/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.12sui.cn/develop/yahoo-util-dom-getelementsbyclassname-improve/</link>
	<description>南芝的前端技术学习经验</description>
	<lastBuildDate>Mon, 09 Jan 2012 09:25:05 +0800</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>rainoxu</title>
		<link>http://www.12sui.cn/develop/yahoo-util-dom-getelementsbyclassname-improve/comment-page-1/#comment-310</link>
		<dc:creator>rainoxu</dc:creator>
		<pubDate>Fri, 17 Apr 2009 08:54:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.12sui.cn/?p=323#comment-310</guid>
		<description>&lt;p&gt;我觉得用半角逗号更符合习惯一点，呵呵~~~&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>我觉得用半角逗号更符合习惯一点，呵呵~~~</p>]]></content:encoded>
	</item>
	<item>
		<title>南芝</title>
		<link>http://www.12sui.cn/develop/yahoo-util-dom-getelementsbyclassname-improve/comment-page-1/#comment-306</link>
		<dc:creator>南芝</dc:creator>
		<pubDate>Tue, 14 Apr 2009 12:30:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.12sui.cn/?p=323#comment-306</guid>
		<description>&lt;p&gt;@遇春 感谢指正哈~&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@遇春 感谢指正哈~</p>]]></content:encoded>
	</item>
	<item>
		<title>南芝</title>
		<link>http://www.12sui.cn/develop/yahoo-util-dom-getelementsbyclassname-improve/comment-page-1/#comment-305</link>
		<dc:creator>南芝</dc:creator>
		<pubDate>Tue, 14 Apr 2009 12:28:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.12sui.cn/?p=323#comment-305</guid>
		<description>&lt;p&gt;@小马 @明城 感谢哈。。我记得上次小马有说。。我当时还看了。。。然后就忘了。。。丢人了哈~&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@小马 @明城 感谢哈。。我记得上次小马有说。。我当时还看了。。。然后就忘了。。。丢人了哈~</p>]]></content:encoded>
	</item>
	<item>
		<title>遇春</title>
		<link>http://www.12sui.cn/develop/yahoo-util-dom-getelementsbyclassname-improve/comment-page-1/#comment-304</link>
		<dc:creator>遇春</dc:creator>
		<pubDate>Tue, 14 Apr 2009 08:14:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.12sui.cn/?p=323#comment-304</guid>
		<description>&lt;h2&gt;单独提一个局部小问题：&lt;/h2&gt;

&lt;p&gt;//剔除相同的节点&lt;br /&gt;
for (var k = 0; k &lt; nodes.length; k++) {
   for(var l = k+1; l &lt; nodes.length; l++) {
      if(nodes[k] == nodes[l]) {
          nodes.splice(l,1);
         }
     }&lt;/p&gt;

&lt;h2&gt;}&lt;/h2&gt;

&lt;p&gt;这段代码跑起来，如果真的有相同节点的话会出错的。一般遍历去剔除列表里的元素要从后往前遍历。&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<h2>单独提一个局部小问题：</h2>

<p>//剔除相同的节点<br />
for (var k = 0; k &lt; nodes.length; k++) {
   for(var l = k+1; l &lt; nodes.length; l++) {
      if(nodes[k] == nodes[l]) {
          nodes.splice(l,1);
         }
     }</p>

<h2>}</h2>

<p>这段代码跑起来，如果真的有相同节点的话会出错的。一般遍历去剔除列表里的元素要从后往前遍历。</p>]]></content:encoded>
	</item>
	<item>
		<title>小马</title>
		<link>http://www.12sui.cn/develop/yahoo-util-dom-getelementsbyclassname-improve/comment-page-1/#comment-303</link>
		<dc:creator>小马</dc:creator>
		<pubDate>Tue, 14 Apr 2009 07:55:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.12sui.cn/?p=323#comment-303</guid>
		<description>&lt;p&gt;妈的，被抢沙发了！&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>妈的，被抢沙发了！</p>]]></content:encoded>
	</item>
	<item>
		<title>小马</title>
		<link>http://www.12sui.cn/develop/yahoo-util-dom-getelementsbyclassname-improve/comment-page-1/#comment-302</link>
		<dc:creator>小马</dc:creator>
		<pubDate>Tue, 14 Apr 2009 07:54:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.12sui.cn/?p=323#comment-302</guid>
		<description>&lt;p&gt;注意，YUI 2.7.0 里getElementsByClassName()的第一个参数支持正则表达式，所以，你可以直接这么调用：&lt;/p&gt;

&lt;p&gt;YAHOO.util.Dom.getElementsByClassName(/hehe&#124;haha&#124;heihei/)。&lt;/p&gt;

&lt;p&gt;try it！&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>注意，YUI 2.7.0 里getElementsByClassName()的第一个参数支持正则表达式，所以，你可以直接这么调用：</p>

<p>YAHOO.util.Dom.getElementsByClassName(/hehe|haha|heihei/)。</p>

<p>try it！</p>]]></content:encoded>
	</item>
	<item>
		<title>明城</title>
		<link>http://www.12sui.cn/develop/yahoo-util-dom-getelementsbyclassname-improve/comment-page-1/#comment-301</link>
		<dc:creator>明城</dc:creator>
		<pubDate>Tue, 14 Apr 2009 01:50:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.12sui.cn/?p=323#comment-301</guid>
		<description>&lt;p&gt;其实 getElementsByClassName 支持正则表达式操作，相关代码&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var getClassRegEx = function(className) {
    var re = reClassNameCache[className];
    if (!re) {
        re = new RegExp(&#039;(?:^&#124;\\s+)&#039; + className + &#039;(?:\\s+&#124;$)&#039;);
        reClassNameCache[className] = re;
    }
    return re;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;所以可得出 className 可以是正则表达式的一部分，那么去多个就很好搞定了。 :^)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>其实 getElementsByClassName 支持正则表达式操作，相关代码</p>

<pre><code>var getClassRegEx = function(className) {
    var re = reClassNameCache[className];
    if (!re) {
        re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
        reClassNameCache[className] = re;
    }
    return re;
};
</code></pre>

<p>所以可得出 className 可以是正则表达式的一部分，那么去多个就很好搞定了。 :^)</p>]]></content:encoded>
	</item>
</channel>
</rss>

