Html webshim polyfill帆布赢得';不能在IE7模式下工作

Html webshim polyfill帆布赢得';不能在IE7模式下工作,html,jquery-plugins,canvas,excanvas,webshim,Html,Jquery Plugins,Canvas,Excanvas,Webshim,我在让webshims插件canvas polyfill工作时遇到问题 我在使用IE7模式的IE9中遇到以下错误: SCRIPT438: Object doesn't support property or method 'fillRect' problem.html, line 21 character 7 当我尝试运行此代码时: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <

我在让webshims插件canvas polyfill工作时遇到问题

我在使用IE7模式的IE9中遇到以下错误:

  SCRIPT438: Object doesn't support property or method 'fillRect'
  problem.html, line 21 character 7
当我尝试运行此代码时:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
    <title>DealingTree</title>
    <meta http-equiv="Content-type" content="text/html;charset=utf-8"/>
    <script type="text/javascript" src="/js/modernizr.js"> </script>
    <script type="text/javascript" src="/js/jquery.js"> </script>
    <script type="text/javascript" src="/js/sssl.js"> </script>
    <script type="text/javascript" src="/js/webshims/js-webshim/minified/polyfiller.js"> </script>
  </head>
  <body>
    <canvas id="savings" height="350" width="700"> </canvas>
    <script type="text/javascript">
      //<![CDATA[
      window.FlashCanvasOptions = { disableContextMenu: true };
      $.webshims.setOptions( 'canvas', { type: 'flashpro' } );
      $.webshims.polyfill('canvas');
      var canvas = $('#savings');
      var context = canvas.getContext('2d');
      context.fillStyle='#F00';
      context.fillRect(0,0,700,350);
      //]>
    </script>
  </body>
</html>

交易树
//
无论我使用默认(excanvas)还是flashpro,问题都会出现

更新:在我看来,getContext()返回的是jQuery对象,而不是上下文


请提供帮助?

我通过电子邮件收到了插件作者Alexander Farkas的以下解释:

问题如下。韦伯希姆 使用脚本进行异步多边形填充 加载器。这对性能有好处 在现代浏览器中。也就是说,, 你必须等到 画布功能已就绪

您的代码应该包装在 domready事件,一切正常:

您可以找到有关您的应用程序的更多信息 文档中的问题@


以下是插件的主页:
window.FlashCanvasOptions = { disableContextMenu: true };
$.webshims.setOptions( 'canvas', { type: 'flashpro' } );
$.webshims.polyfill('canvas');
$(function(){
     var canvas = $('#savings');
     var context = canvas.getContext('2d');
     context.fillStyle='#F00';
     context.fillRect(0,0,700,350);
});