<?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: Monday code giveaway: getElementsByAttribute</title>
	<atom:link href="http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/</link>
	<description>Web development and Internet trends</description>
	<lastBuildDate>Sat, 20 Mar 2010 05:17:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: getElementsBy* &#171; Dogfeeds——IT Telescope</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-589288</link>
		<dc:creator>getElementsBy* &#171; Dogfeeds——IT Telescope</dc:creator>
		<pubDate>Sat, 13 Jun 2009 05:57:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-589288</guid>
		<description>[...] getElementsByAttribute [...]</description>
		<content:encoded><![CDATA[<p>[...] getElementsByAttribute [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Obteniendo elementos mediante selectores de atributos en Javascript - JSEROS Dise&#241;o y Desarrollo web &#124; General</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-563903</link>
		<dc:creator>Obteniendo elementos mediante selectores de atributos en Javascript - JSEROS Dise&#241;o y Desarrollo web &#124; General</dc:creator>
		<pubDate>Tue, 07 Apr 2009 11:44:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-563903</guid>
		<description>[...] fuera de un framework como jQuery o Mootools. Actualmente existen unas cuantas escritas como la de Robert Nyman y la incluida en el diccionario XUL de desarrollo de extensiones para [...]</description>
		<content:encoded><![CDATA[<p>[...] fuera de un framework como jQuery o Mootools. Actualmente existen unas cuantas escritas como la de Robert Nyman y la incluida en el diccionario XUL de desarrollo de extensiones para [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: separati.st &#187; Daily Interesting Shizzle for February 25th</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-531196</link>
		<dc:creator>separati.st &#187; Daily Interesting Shizzle for February 25th</dc:creator>
		<pubDate>Wed, 25 Feb 2009 13:28:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-531196</guid>
		<description>[...] Monday code giveaway: getElementsByAttribute - Robert&#8217;s talk - Web development and Internet tr... [...]</description>
		<content:encoded><![CDATA[<p>[...] Monday code giveaway: getElementsByAttribute &#8211; Robert&rsquo;s talk &#8211; Web development and Internet tr&#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kok Chuan</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-32977</link>
		<dc:creator>Kok Chuan</dc:creator>
		<pubDate>Sat, 03 Feb 2007 18:19:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-32977</guid>
		<description>Hi, this code works great. However i&#039;ve found something that causes it not to work properly.

when i create a &quot;input&quot; form control without specifying the type, it defaults to type=&quot;text&quot;. your current script is not able to work with this &quot;lazy&quot; coding :D</description>
		<content:encoded><![CDATA[<p>Hi, this code works great. However i&#8217;ve found something that causes it not to work properly.</p>
<p>when i create a &#8220;input&#8221; form control without specifying the type, it defaults to type=&#8221;text&#8221;. your current script is not able to work with this &#8220;lazy&#8221; coding <img src='http://robertnyman.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-19722</link>
		<dc:creator>Gary</dc:creator>
		<pubDate>Fri, 01 Dec 2006 22:00:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-19722</guid>
		<description>Okay, so I&#039;m wondering if someone could kindly help me with this a bit.  Long story why, but in essence I want to find the ID of a single div element among many which have been dynamically generated in javascript (each element is assigned an ID along the lines of cell_1_2, cell_1_3, etc).  That element has a unique style (a background color) and is the only element belonging to a specific class (called &quot;highlighted&quot;).

I&#039;m not sure if this is the right function, or if getElementByClass is better, but in either case I&#039;m having a hard time returning the ID of that single element.

Any thoughts?  Much appreciated ...</description>
		<content:encoded><![CDATA[<p>Okay, so I&#8217;m wondering if someone could kindly help me with this a bit.  Long story why, but in essence I want to find the ID of a single div element among many which have been dynamically generated in javascript (each element is assigned an ID along the lines of cell_1_2, cell_1_3, etc).  That element has a unique style (a background color) and is the only element belonging to a specific class (called &#8220;highlighted&#8221;).</p>
<p>I&#8217;m not sure if this is the right function, or if getElementByClass is better, but in either case I&#8217;m having a hard time returning the ID of that single element.</p>
<p>Any thoughts?  Much appreciated &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-16383</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Mon, 13 Nov 2006 08:00:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-16383</guid>
		<description>Matthew,

No problem at all! I hope everything works out for you.</description>
		<content:encoded><![CDATA[<p>Matthew,</p>
<p>No problem at all! I hope everything works out for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Krivanek</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-16156</link>
		<dc:creator>Matthew Krivanek</dc:creator>
		<pubDate>Sun, 12 Nov 2006 00:50:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-16156</guid>
		<description>Thanks for the tip and thanks again for the script!

-mk</description>
		<content:encoded><![CDATA[<p>Thanks for the tip and thanks again for the script!</p>
<p>-mk</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EJ - The only JavaScript library you&#8217;ll ever need - Robert&#8217;s talk</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-15073</link>
		<dc:creator>EJ - The only JavaScript library you&#8217;ll ever need - Robert&#8217;s talk</dc:creator>
		<pubDate>Tue, 07 Nov 2006 10:24:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-15073</guid>
		<description>[...] d, if you want to, a certain value in that attribute as well. More thoroughly described in Monday code giveaway: getElementsByAttribute.     preventDefau [...]</description>
		<content:encoded><![CDATA[<p>[...] d, if you want to, a certain value in that attribute as well. More thoroughly described in Monday code giveaway: getElementsByAttribute.     preventDefau [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-14893</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Mon, 06 Nov 2006 07:56:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-14893</guid>
		<description>Matthew,

Interesting. However, the way I see it, &lt;code&gt;style&lt;/code&gt; isn&#039;t really an attribute in that sense. You never set a style through &lt;code&gt;setAttribute&lt;/code&gt;, but instead by using the &lt;code&gt;.style&lt;/code&gt; notation.

If your code works in your case, I&#039;m happy for you, but I don&#039;t find it necessary to incorporate in the standard version of the script.

A little suggestion: Instead of checking for web browser name, you can use &lt;code&gt;if(document.all)&lt;/code&gt; and then a check for &lt;code&gt;if(typeof oAttribute.cssText != &quot;undefined)&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>Matthew,</p>
<p>Interesting. However, the way I see it, <code>style</code> isn&#8217;t really an attribute in that sense. You never set a style through <code>setAttribute</code>, but instead by using the <code>.style</code> notation.</p>
<p>If your code works in your case, I&#8217;m happy for you, but I don&#8217;t find it necessary to incorporate in the standard version of the script.</p>
<p>A little suggestion: Instead of checking for web browser name, you can use <code>if(document.all)</code> and then a check for <code>if(typeof oAttribute.cssText != "undefined)</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Krivanek</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-14779</link>
		<dc:creator>Matthew Krivanek</dc:creator>
		<pubDate>Sun, 05 Nov 2006 18:10:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-14779</guid>
		<description>Ok, so, my code broke Firefox. This is dirty, but works.

&lt;code&gt;if (navigator.appName == &#039;Microsoft Internet Explorer&#039;)
		{
			oAttribute = oAttribute.cssText;
		}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Ok, so, my code broke Firefox. This is dirty, but works.</p>
<p><code>if (navigator.appName == 'Microsoft Internet Explorer')<br />
		{<br />
			oAttribute = oAttribute.cssText;<br />
		}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Krivanek</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-14778</link>
		<dc:creator>Matthew Krivanek</dc:creator>
		<pubDate>Sun, 05 Nov 2006 17:54:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-14778</guid>
		<description>It&#039;s seems I may have found a solution, however, not so graceful.

Due to the way IE works, when trying to get the &#039;style&#039; attribute, IE&#039;s getAttribute function returns an object. 

The work around I found was to set the oAttribute variable using the .cssText property for IE. I believe that the &#039;style&#039; attribute is the only attribute stored as an object in IE.  I could be wrong though...

My modification to your function:

&lt;code&gt;
/*
    Copyright Robert Nyman, http://www.robertnyman.com
    Free to use if this text is included
*/
function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue){
    var arrElements = (strTagName == &quot;*&quot; &amp;&amp; oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    var oAttributeValue = (typeof strAttributeValue != &quot;undefined&quot;)? new RegExp(&quot;(^&#124;\\s)&quot; + strAttributeValue + &quot;(\\s&#124;$)&quot;) : null;
    var oCurrent;
    var oAttribute;
    for(var i=0; iif(typeof oAttribute == &quot;object&quot;){
			oAttribute = oAttribute.cssText;
	}&lt;/b&gt;
        if(typeof oAttribute == &quot;string&quot; &amp;&amp; oAttribute.length &gt; 0){
            if(typeof strAttributeValue == &quot;undefined&quot; &#124;&#124; (oAttributeValue &amp;&amp; oAttributeValue.test(oAttribute))){
                arrReturnElements.push(oCurrent);
            }
        }
    }
    return arrReturnElements; 
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>It&#8217;s seems I may have found a solution, however, not so graceful.</p>
<p>Due to the way IE works, when trying to get the &#8217;style&#8217; attribute, IE&#8217;s getAttribute function returns an object. </p>
<p>The work around I found was to set the oAttribute variable using the .cssText property for IE. I believe that the &#8217;style&#8217; attribute is the only attribute stored as an object in IE.  I could be wrong though&#8230;</p>
<p>My modification to your function:</p>
<p><code><br />
/*<br />
    Copyright Robert Nyman, <a href="http://www.robertnyman.com" rel="nofollow">http://www.robertnyman.com</a><br />
    Free to use if this text is included<br />
*/<br />
function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue){<br />
    var arrElements = (strTagName == "*" &amp;&amp; oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);<br />
    var arrReturnElements = new Array();<br />
    var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)") : null;<br />
    var oCurrent;<br />
    var oAttribute;<br />
    for(var i=0; iif(typeof oAttribute == "object"){<br />
			oAttribute = oAttribute.cssText;<br />
	}<br />
        if(typeof oAttribute == "string" &amp;&amp; oAttribute.length &gt; 0){<br />
            if(typeof strAttributeValue == "undefined" || (oAttributeValue &amp;&amp; oAttributeValue.test(oAttribute))){<br />
                arrReturnElements.push(oCurrent);<br />
            }<br />
        }<br />
    }<br />
    return arrReturnElements;<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Krivanek</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-14774</link>
		<dc:creator>Matthew Krivanek</dc:creator>
		<pubDate>Sun, 05 Nov 2006 16:43:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-14774</guid>
		<description>What I&#039;m trying to do is find all instances of inline styles and remove them.

However, it seems that the attribute &#039;style&#039; does not get returned in IE.  I&#039;ve tested in other browsers and the &#039;style&#039; attribute is found, but IE, the array is returned empty.

Any thoughts on how to make this work?</description>
		<content:encoded><![CDATA[<p>What I&#8217;m trying to do is find all instances of inline styles and remove them.</p>
<p>However, it seems that the attribute &#8217;style&#8217; does not get returned in IE.  I&#8217;ve tested in other browsers and the &#8217;style&#8217; attribute is found, but IE, the array is returned empty.</p>
<p>Any thoughts on how to make this work?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-13226</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Sun, 22 Oct 2006 19:29:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-13226</guid>
		<description>Simon,

Weird... I use it all the time and haven&#039;t ahd any problems with IE 6. For example, with my &lt;a href=&quot;http://www.robertnyman.com/2006/09/27/glt-good-looking-tooltips/&quot; rel=&quot;nofollow&quot;&gt;GLT&lt;/a&gt; library it&#039;s vital.</description>
		<content:encoded><![CDATA[<p>Simon,</p>
<p>Weird&#8230; I use it all the time and haven&#8217;t ahd any problems with IE 6. For example, with my <a href="http://www.robertnyman.com/2006/09/27/glt-good-looking-tooltips/" rel="nofollow">GLT</a> library it&#8217;s vital.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-13113</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Sat, 21 Oct 2006 18:59:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-13113</guid>
		<description>Works great in firefox and opera but not at all in IE6 for my implemention.
But as it&#039;s the class I wanted I found your getElementsByClassName which worked fine in all 3 browsers.</description>
		<content:encoded><![CDATA[<p>Works great in firefox and opera but not at all in IE6 for my implemention.<br />
But as it&#8217;s the class I wanted I found your getElementsByClassName which worked fine in all 3 browsers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hakan Bilgin</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-9259</link>
		<dc:creator>Hakan Bilgin</dc:creator>
		<pubDate>Thu, 14 Sep 2006 14:57:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-9259</guid>
		<description>Ok...thanx anyway.

/hbi</description>
		<content:encoded><![CDATA[<p>Ok&#8230;thanx anyway.</p>
<p>/hbi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-9245</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Thu, 14 Sep 2006 10:26:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-9245</guid>
		<description>Hakan,

Unfortunately, I don&#039;t have an answer for you. I never get time nor assigned to play around with such fun stuff! :-)</description>
		<content:encoded><![CDATA[<p>Hakan,</p>
<p>Unfortunately, I don&#8217;t have an answer for you. I never get time nor assigned to play around with such fun stuff! <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hakan Bilgin</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-9193</link>
		<dc:creator>Hakan Bilgin</dc:creator>
		<pubDate>Wed, 13 Sep 2006 22:23:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-9193</guid>
		<description>Hi Robert,
I am currently experimenting with &quot;custom&quot; namespaces and have discovered that the interface in Firefox is a little unsatisfactory. For instance in IE, with the properties &lt;b&gt;scopeName&lt;/b&gt; and &lt;b&gt;nodeName&lt;/b&gt;, I can find out contextual information about a certain element.

In Firefox, scopeName does not exist at all (but I have extended as seen below) and nodeName returns both the namespace and the nodeName, united by a colon...in upperCase.

Node.prototype.__defineGetter__(&#039;scopeName&#039;, function() {
var nn = this.nodeName.toString();
return (nn.indexOf(&#039;:&#039;) &gt; -1)? nn.split(&#039;:&#039;)[0].toLowerCase() : &#039;HTML&#039; ;
});

I find the Firefox interface poor and limiting. But than again, I might be missing out on something...so I hope you shed some light to the subject. Do you know any way to extract the properties of an element in a suitable way in Firefox?

BR,
/hbi</description>
		<content:encoded><![CDATA[<p>Hi Robert,<br />
I am currently experimenting with &#8220;custom&#8221; namespaces and have discovered that the interface in Firefox is a little unsatisfactory. For instance in IE, with the properties <b>scopeName</b> and <b>nodeName</b>, I can find out contextual information about a certain element.</p>
<p>In Firefox, scopeName does not exist at all (but I have extended as seen below) and nodeName returns both the namespace and the nodeName, united by a colon&#8230;in upperCase.</p>
<p>Node.prototype.__defineGetter__(&#8217;scopeName&#8217;, function() {<br />
var nn = this.nodeName.toString();<br />
return (nn.indexOf(&#8216;:&#8217;) &gt; -1)? nn.split(&#8216;:&#8217;)[0].toLowerCase() : &#8216;HTML&#8217; ;<br />
});</p>
<p>I find the Firefox interface poor and limiting. But than again, I might be missing out on something&#8230;so I hope you shed some light to the subject. Do you know any way to extract the properties of an element in a suitable way in Firefox?</p>
<p>BR,<br />
/hbi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-5571</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Tue, 20 Jun 2006 12:34:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-5571</guid>
		<description>Jim,

I didn&#039;t know that. My guess is that it &lt;em&gt;is&lt;/em&gt; probably intentional by Firefox since they want to be as valid and correct as possible, and custom attributes shouldn&#039;t be in the HTML code (this is a big discussion for another day... :-)) and aren&#039;t allowed if you want to have a web page with valid code (unless you use a custom DTD and so on).

Anyway, with that said, if you have that specific need for custom attributes I&#039;m happy to hear that your workaround seems to work out fine for you. However, I will let this function hold on to the W3C recommended way of accessing attributes in the DOM.</description>
		<content:encoded><![CDATA[<p>Jim,</p>
<p>I didn&#8217;t know that. My guess is that it <em>is</em> probably intentional by Firefox since they want to be as valid and correct as possible, and custom attributes shouldn&#8217;t be in the HTML code (this is a big discussion for another day&#8230; <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ) and aren&#8217;t allowed if you want to have a web page with valid code (unless you use a custom DTD and so on).</p>
<p>Anyway, with that said, if you have that specific need for custom attributes I&#8217;m happy to hear that your workaround seems to work out fine for you. However, I will let this function hold on to the W3C recommended way of accessing attributes in the DOM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jim</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-5570</link>
		<dc:creator>jim</dc:creator>
		<pubDate>Tue, 20 Jun 2006 09:26:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-5570</guid>
		<description>Hi,

I haven&#039;t done extensive testing on this, but I seem to have stumbled across a problem with &lt;strong&gt;custom&lt;/strong&gt; attributes.

I have following element:
&lt;code&gt;
&lt;input type=&quot;button&quot; &lt;strong&gt;foo=&quot;bar&quot;&lt;/strong&gt; value=&quot;initValue&quot;/&gt;
&lt;/code&gt;
If I call your function as follows:
&lt;code&gt;
var buttons = getElementsByAttribute(document.body, &#039;input&#039;, &#039;foo&#039;, &#039;bar&#039;);
&lt;/code&gt;
I get null result in Firefox 1.5.0.4 (it&#039;s ok on IE6).
By changing your line:
&lt;code&gt;
oAttribute = oCurrent.getAttribute(strAttributeName);
&lt;/code&gt;
to instead use eval() to do direct property access:
&lt;code&gt;
oAttribute = eval(&#039;oCurrent.&#039;+strAttributeName);
&lt;/code&gt;
it seems to work ok on both Firefox and IE6. I&#039;m assuming there is no intentional restriction in getAttribute function with regards to custom attributes, and that this is just a bug in Firefox Element::getAttribute.
Thanks for your function!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I haven&#8217;t done extensive testing on this, but I seem to have stumbled across a problem with <strong>custom</strong> attributes.</p>
<p>I have following element:<br />
<code><br />
&lt;input type="button" <strong>foo="bar"</strong> value="initValue"/&gt;<br />
</code><br />
If I call your function as follows:<br />
<code><br />
var buttons = getElementsByAttribute(document.body, 'input', 'foo', 'bar');<br />
</code><br />
I get null result in Firefox 1.5.0.4 (it&#8217;s ok on IE6).<br />
By changing your line:<br />
<code><br />
oAttribute = oCurrent.getAttribute(strAttributeName);<br />
</code><br />
to instead use eval() to do direct property access:<br />
<code><br />
oAttribute = eval('oCurrent.'+strAttributeName);<br />
</code><br />
it seems to work ok on both Firefox and IE6. I&#8217;m assuming there is no intentional restriction in getAttribute function with regards to custom attributes, and that this is just a bug in Firefox Element::getAttribute.<br />
Thanks for your function!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bob</title>
		<link>http://robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-4964</link>
		<dc:creator>bob</dc:creator>
		<pubDate>Thu, 18 May 2006 11:07:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/01/23/monday-code-giveaway-getelementsbyattribute/#comment-4964</guid>
		<description>third time I&#039;ve come back for this after losing it - about time I said thanks.

thanks.</description>
		<content:encoded><![CDATA[<p>third time I&#8217;ve come back for this after losing it &#8211; about time I said thanks.</p>
<p>thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
