Firefoxで計算済みの背景色が取得できないケースがある

既知だろうから、これは自分用のメモ。

<html><head><title>checkbox bg-color</title>
<style>.green { background-color: lime }</style>
</head><body>
<input id="tgt1" type="checkbox" checked="checked" class="green"></input>
<input id="tgt2" type="radio" checked="checked" class="green"></input>
<select size="1">
  <option id="tgt3" class="green">A</option>
  <option id="tgt4" class="green">B</option>
  <option id="tgt5" class="green">C</option>
</select>
<script>
window.onload = function() {
  var rv = [test("tgt1"), test("tgt2"), test("tgt3"), test("tgt4"), test("tgt5")];
  alert(rv.join(","));
};
function test(id) {
  var elm = document.getElementById(id);
  var cs = document.uniqueID ? elm.currentStyle : document.defaultView.getComputedStyle(elm, "");
  return cs.backgroundColor;
}
</script>
</body></html>

Firefox以外のブラウザは、"lime"(IE) or "rgb(0, 255, 0)"(WebKit) or "#00ff00"(Opera) となるが、Firefox(2.0〜3.1)は、checkbox(tgt1), radio(tgt2) が rgb(255, 255, 255)になり、一番上のoption(tgt3)が rgb(0, 128, 0) になる。
背景色の変化が検出できずテストの自動化に影響した。