<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>仙人の心得 &#187; javascript</title>
	<atom:link href="http://blog.mktime.com/archive/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.mktime.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 31 Aug 2010 12:04:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/category/javascript/feed" />
		<item>
		<title>prototype.js：firefox3で&#8221;each is not a function&#8221;</title>
		<link>http://blog.mktime.com/archive/7.html</link>
		<comments>http://blog.mktime.com/archive/7.html#comments</comments>
		<pubDate>Tue, 08 Jul 2008 00:13:42 +0000</pubDate>
		<dc:creator>nak</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[prototype.js]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=5</guid>
		<description><![CDATA[
こんなバッドノウハウを使うことは２度と無いだろうと思ってメモらなかったら、今日思い出せなくて苦しんだので、今度こそメモる。

firefox3で&#8221;each is not a function&#8221;の [...]]]></description>
			<content:encoded><![CDATA[<p>
こんなバッドノウハウを使うことは２度と無いだろうと思ってメモらなかったら、今日思い出せなくて苦しんだので、今度こそメモる。<br />
<br />
firefox3で&#8221;each is not a function&#8221;のエラーが出るときは.getElementsByClassName()を調べること。<br />
firefox3ではgetElementsByClassName()はネイティブ実装されている。そしてこの関数が返す型はfirefox2と3で異なる。<br />
<br />
firefox2…HTMLElementのサブインターフェース<br />
firefox3…HTMLCollection<br />
<br />
なのでfirefox3ではelements.each(function(element))～みたいな命令がエラーになる。<br />
<br />
対処方法は↓このへんがお手軽。<br />
・elements.getElementsByClassName(&#8220;hoge&#8221;) を$A(&#8220;hoge&#8221;)に置き換える。<br />
・elements.getElementsByClassName(&#8220;hoge&#8221;) をelements.select(&#8220;.hoge&#8221;)に置き換える。<br />
・.eachを使わず、forやwhileで処理する<br />
<br />
せっかく処理速度が速くなっているのでなるべくネイティブ実装のgetElementsByClassName()を使ったほうがいいはず。なのでエラーになるところだけ、上記のように書き換える。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/7.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/7.html" />
	</item>
	</channel>
</rss>
