<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Javascript: getElementById() for XML fragments and arbitrary XML documents + getElementsByAttribute()</title>
	<atom:link href="http://www.drunkenfist.com/304/2007/06/12/javascript-getelementbyid-for-xml-fragments-and-arbitrary-documents-getelementsbyattribute/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.drunkenfist.com/304/2007/06/12/javascript-getelementbyid-for-xml-fragments-and-arbitrary-documents-getelementsbyattribute/</link>
	<description>Rob Larsen writes on web design and development, entertainment, sports and culture.</description>
	<pubDate>Fri, 21 Nov 2008 04:56:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: rob</title>
		<link>http://www.drunkenfist.com/304/2007/06/12/javascript-getelementbyid-for-xml-fragments-and-arbitrary-documents-getelementsbyattribute/#comment-14022</link>
		<dc:creator>rob</dc:creator>
		<pubDate>Wed, 13 Jun 2007 13:56:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.drunkenfist.com/304/2007/06/12/javascript-getelementbyid-for-xml-fragments-and-arbitrary-documents-getelementsbyattribute/#comment-14022</guid>
		<description>definitely not meant as a replacement for getElementsByClass. To be honest, I'm not sure how I would use it as it was a pure "hey, I could do that too" kind of thing. I can imagine some uses  and once I put it to use, I imagine there'll be some adjustments to make.

Speaking of which-

push(). *duh* Thanks :)</description>
		<content:encoded><![CDATA[<p>definitely not meant as a replacement for getElementsByClass. To be honest, I'm not sure how I would use it as it was a pure "hey, I could do that too" kind of thing. I can imagine some uses  and once I put it to use, I imagine there'll be some adjustments to make.</p>
<p>Speaking of which-</p>
<p>push(). *duh* Thanks <img src='http://www.drunkenfist.com/304/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://www.drunkenfist.com/304/2007/06/12/javascript-getelementbyid-for-xml-fragments-and-arbitrary-documents-getelementsbyattribute/#comment-14021</link>
		<dc:creator>steve</dc:creator>
		<pubDate>Wed, 13 Jun 2007 13:48:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.drunkenfist.com/304/2007/06/12/javascript-getelementbyid-for-xml-fragments-and-arbitrary-documents-getelementsbyattribute/#comment-14021</guid>
		<description>Doh!... Less than symbol stripped out... lets try this:

function getElementsByAttribute(the_node, the_attribute, the_value){
  var node_tags = the_node.getElementsByTagName('*');
  var results = [];
  for(var i=0;i&#60;node_tags.length;i++){
    if(node_tags[i].hasAttribute(the_attribute)){
      if(node_tags[i].getAttribute(the_attribute) == the_value){
        results.push(node_tags[i]);
      }
    }
  }
  return results;
}</description>
		<content:encoded><![CDATA[<p>Doh!&#8230; Less than symbol stripped out&#8230; lets try this:</p>
<p>function getElementsByAttribute(the_node, the_attribute, the_value){<br />
  var node_tags = the_node.getElementsByTagName('*');<br />
  var results = [];<br />
  for(var i=0;i&lt;node_tags.length;i++){<br />
    if(node_tags[i].hasAttribute(the_attribute)){<br />
      if(node_tags[i].getAttribute(the_attribute) == the_value){<br />
        results.push(node_tags[i]);<br />
      }<br />
    }<br />
  }<br />
  return results;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://www.drunkenfist.com/304/2007/06/12/javascript-getelementbyid-for-xml-fragments-and-arbitrary-documents-getelementsbyattribute/#comment-14020</link>
		<dc:creator>steve</dc:creator>
		<pubDate>Wed, 13 Jun 2007 13:47:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.drunkenfist.com/304/2007/06/12/javascript-getelementbyid-for-xml-fragments-and-arbitrary-documents-getelementsbyattribute/#comment-14020</guid>
		<description>A few notes...

1.) I hope this wasn't meant as a replacement for the getElementsByClass, as it will fail if more than one class is applied to an element. ;-)

2.) Minor, but you can save some code, and avoid some global variables (i &#38; j), with a few adjustments to your function.

function getElementsByAttribute(the_node, the_attribute, the_value){
  var node_tags = the_node.getElementsByTagName('*');
  var results = [];
  for(var i=0;i</description>
		<content:encoded><![CDATA[<p>A few notes&#8230;</p>
<p>1.) I hope this wasn't meant as a replacement for the getElementsByClass, as it will fail if more than one class is applied to an element. <img src='http://www.drunkenfist.com/304/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>2.) Minor, but you can save some code, and avoid some global variables (i &amp; j), with a few adjustments to your function.</p>
<p>function getElementsByAttribute(the_node, the_attribute, the_value){<br />
  var node_tags = the_node.getElementsByTagName('*');<br />
  var results = [];<br />
  for(var i=0;i</p>
]]></content:encoded>
	</item>
</channel>
</rss>
