<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: getElementsByTagName()</title>
	<atom:link href="http://dean.edwards.name/weblog/2009/12/getelementsbytagname/feed/" rel="self" type="application/rss+xml" />
	<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/</link>
	<description>JavaScript, DHTML and browser hacking</description>
	<lastBuildDate>Wed, 22 Feb 2012 15:04:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Mantronic-Software &#187; JavaScript Tricks: getElementsByTagName() und EDIT MODE / designMode</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-369406</link>
		<dc:creator>Mantronic-Software &#187; JavaScript Tricks: getElementsByTagName() und EDIT MODE / designMode</dc:creator>
		<pubDate>Wed, 10 Mar 2010 20:18:21 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-369406</guid>
		<description>[...] Quelle hier [...]</description>
		<content:encoded><![CDATA[[...] Quelle hier [...]]]></content:encoded>
	</item>
	<item>
		<title>By: Andrea Giammarchi</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-367129</link>
		<dc:creator>Andrea Giammarchi</dc:creator>
		<pubDate>Tue, 29 Dec 2009 18:18:32 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-367129</guid>
		<description>&lt;p&gt;I need some rest ...&lt;/p&gt;
&lt;pre class=&quot;javascript&quot;&gt;
function getElementsByTagName(node, nodeName){
    for(var
        tmp = document.createElement(&quot;tmp&quot;),
        childNodes = tmp.appendChild(node) &amp;&amp; tmp.getElementsByTagName(nodeName),
        i = 0, length = childNodes.length,
        result = [];
        i &lt; length; ++i
    )
        result[i] = childNodes[i]
    ;
    childNodes = tmp.childNodes;
    length = childNodes.length;
    while(length--)
        node.appendChild(childNodes[0])
    ;
    return tmp = result;
};
&lt;/pre&gt;
&lt;p&gt;could be probably smaller via while ...&lt;/p&gt;
&lt;pre class=&quot;javascript&quot;&gt;
    while(childNodes = tmp.firstChild)
        node.appendChild(childNodes)
    ;
&lt;/pre&gt;
&lt;p&gt;not sure which one will perform better though ... I&#039;ll try some bench later ;-)
&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>I need some rest &#8230;</p>
<pre class="javascript">
function getElementsByTagName(node, nodeName){
    for(var
        tmp = document.createElement("tmp"),
        childNodes = tmp.appendChild(node) &#038;&#038; tmp.getElementsByTagName(nodeName),
        i = 0, length = childNodes.length,
        result = [];
        i < length; ++i
    )
        result[i] = childNodes[i]
    ;
    childNodes = tmp.childNodes;
    length = childNodes.length;
    while(length--)
        node.appendChild(childNodes[0])
    ;
    return tmp = result;
};
</pre>
<p>could be probably smaller via while ...</p>
</pre><pre class="javascript">
    while(childNodes = tmp.firstChild)
        node.appendChild(childNodes)
    ;
</pre>
<p>not sure which one will perform better though ... I'll try some bench later <img src='http://dean.edwards.name/weblog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Andrea Giammarchi</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-367128</link>
		<dc:creator>Andrea Giammarchi</dc:creator>
		<pubDate>Tue, 29 Dec 2009 18:14:13 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-367128</guid>
		<description>&lt;p&gt;still me, I kinda realize how silly was my snippet the instant after I pressed submit :D&lt;/p&gt;
&lt;p&gt;so ... what about this? Still talking about performances, I do like your solution.&lt;/p&gt;
&lt;pre class=&quot;javascript&quot;&gt;
function getElementsByTagName(node, nodeName){
    for(var
        tmp = document.createElement(&quot;tmp&quot;),
        childNodes = tmp.appendChild(node) &amp;&amp; tmp.getElementsByTagName(nodeName),
        i = 0, length = childNodes.length,
        result = [];
        i &lt; length; ++i
    )
        result[i] = childNodes[i]
    ;
    childNodes = tmp.childNodes;
    length = childNodes.length;
    while(length)
        node.appendChild(childNodes[--length])
    ;
    return tmp = result;
};
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>still me, I kinda realize how silly was my snippet the instant after I pressed submit <img src='http://dean.edwards.name/weblog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>so &#8230; what about this? Still talking about performances, I do like your solution.</p>
<pre class="javascript">
function getElementsByTagName(node, nodeName){
    for(var
        tmp = document.createElement("tmp"),
        childNodes = tmp.appendChild(node) &#038;&#038; tmp.getElementsByTagName(nodeName),
        i = 0, length = childNodes.length,
        result = [];
        i < length; ++i
    )
        result[i] = childNodes[i]
    ;
    childNodes = tmp.childNodes;
    length = childNodes.length;
    while(length)
        node.appendChild(childNodes[--length])
    ;
    return tmp = result;
};
</pre></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: -dean</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-367101</link>
		<dc:creator>-dean</dc:creator>
		<pubDate>Mon, 28 Dec 2009 10:17:46 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-367101</guid>
		<description>&lt;p&gt;@Andrea (WebReflection)&lt;/p&gt;
&lt;p&gt;The node list doesn&#039;t need to be live. This is an internal method just for use by selector engines.&lt;/p&gt;
&lt;p&gt;Your solution is a good idea but unfortunately it does not work because of a behaviour unique to document fragments. Once you append a document fragment to an element, the fragment disappears and the fragment&#039;s children become direct children of the element that the fragment is appended to. I hope I explained that properly. :)
&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>@Andrea (WebReflection)</p>
<p>The node list doesn&#8217;t need to be live. This is an internal method just for use by selector engines.</p>
<p>Your solution is a good idea but unfortunately it does not work because of a behaviour unique to document fragments. Once you append a document fragment to an element, the fragment disappears and the fragment&#8217;s children become direct children of the element that the fragment is appended to. I hope I explained that properly. <img src='http://dean.edwards.name/weblog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> 
</p>]]></content:encoded>
	</item>
	<item>
		<title>By: WebReflection</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-367099</link>
		<dc:creator>WebReflection</dc:creator>
		<pubDate>Sun, 27 Dec 2009 18:24:43 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-367099</guid>
		<description>&lt;p&gt;Hi Dean, any bench against this, which is live as well?&lt;/p&gt;
&lt;pre class=&quot;javascript&quot;&gt;
function getElementsByTagName(node, nodeName){
    var tmp = document.createElement(&quot;tmp&quot;);
    return tmp.appendChild(node) &amp;&amp; tmp.getElementsByTagName(nodeName);
};
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Dean, any bench against this, which is live as well?</p>
<pre class="javascript">
function getElementsByTagName(node, nodeName){
    var tmp = document.createElement("tmp");
    return tmp.appendChild(node) &#038;&#038; tmp.getElementsByTagName(nodeName);
};
</pre>]]></content:encoded>
	</item>
	<item>
		<title>By: 網站製作學習誌 &#187; [Web] 連結分享</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-367002</link>
		<dc:creator>網站製作學習誌 &#187; [Web] 連結分享</dc:creator>
		<pubDate>Fri, 25 Dec 2009 16:33:59 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-367002</guid>
		<description>[...] getElementsByTagName() [...]</description>
		<content:encoded><![CDATA[[...] getElementsByTagName() [...]]]></content:encoded>
	</item>
	<item>
		<title>By: Lau S.</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-366933</link>
		<dc:creator>Lau S.</dc:creator>
		<pubDate>Thu, 24 Dec 2009 03:03:36 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-366933</guid>
		<description>&lt;p&gt;It could be a nice NodeList with this method :&lt;/p&gt;
&lt;pre class=&quot;javascript&quot;&gt;
elements.item = function (i) { return this[i]; };
&lt;/pre&gt;
&lt;p&gt;;)
&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>It could be a nice NodeList with this method :</p>
<pre class="javascript">
elements.item = function (i) { return this[i]; };
</pre>
<p> <img src='http://dean.edwards.name/weblog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> 
</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Geoffrey Sneddon</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-366883</link>
		<dc:creator>Geoffrey Sneddon</dc:creator>
		<pubDate>Wed, 23 Dec 2009 12:30:42 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-366883</guid>
		<description>&lt;p&gt;Another thing to avoid for performance is deleting properties (in all the latest engines, that&#039;s something that is really expensive, due to the representation of objects internally).
&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Another thing to avoid for performance is deleting properties (in all the latest engines, that&#8217;s something that is really expensive, due to the representation of objects internally).
</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ivailo Hristov</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-366711</link>
		<dc:creator>Ivailo Hristov</dc:creator>
		<pubDate>Fri, 18 Dec 2009 20:20:36 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-366711</guid>
		<description>&lt;p&gt;I was doing that this way, but your implementation is faster. Thanks!&lt;/p&gt;
&lt;pre class=&quot;javascript&quot;&gt;
function getElementsByTagName( node, tagName ){

};
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I was doing that this way, but your implementation is faster. Thanks!</p>
<pre class="javascript">
function getElementsByTagName( node, tagName ){

};
</pre>]]></content:encoded>
	</item>
	<item>
		<title>By: -dean</title>
		<link>http://dean.edwards.name/weblog/2009/12/getelementsbytagname/comment-page-1/#comment-366644</link>
		<dc:creator>-dean</dc:creator>
		<pubDate>Thu, 17 Dec 2009 21:21:49 +0000</pubDate>
		<guid isPermaLink="false">http://dean.edwards.name/weblog/?p=156#comment-366644</guid>
		<description>&lt;p&gt;Thanks for the feedback everybody, particularly Julian. I&#039;ve updated my code based on your suggestions.
&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Thanks for the feedback everybody, particularly Julian. I&#8217;ve updated my code based on your suggestions.
</p>]]></content:encoded>
	</item>
</channel>
</rss>

