Appcelerator Titanium DesktopでcanvasのgetContextの問題

http://d.hatena.ne.jp/miz_tech/20100304/1267676186

Rubyのコードでは問題なかったです。

以下試したコード。

<!DOCTYPE html>
<html>
  <head>
    <meta charset=UTF-8" />
    <title>test</title>
    <script type="text/ruby">
      def rubyinit
        draw1
        draw2
        draw3
      end

      def draw1
        ctx = document.getElementById('c1').getContext('2d')
        ctx.beginPath()
        ctx.fillRect(20, 20, 80, 40)
      end

      def draw2
        ctx = document.getElementById('c2').getContext('2d')
        ctx.beginPath();
        ctx.strokeRect(20, 20, 80, 40);
      end

      def draw3
        ctx = document.getElementById('c3').getContext('2d')
        ctx.beginPath()
        ctx.fillRect(20, 20, 100, 100)
        ctx.beginPath()
        ctx.clearRect(50, 70, 60, 30)
      end
    </script>
  </head>
  <body onload="rubyinit()">
<h2>fillRect()</h2>
<canvas id="c1" width="140" height="140"></canvas>
<h2>strokeRect()</h2>
<canvas id="c2" width="140" height="140"></canvas>
<h2>clearRect()</h2>
<canvas id="c3" width="140" height="140"></canvas>
  </body>
</html>

まだまだバグはありそうですね。