2016-05-25 45 views
0

这个简单的代码中缺少的是什么?未定义聚合物,Firefox中的参考错误

<!DOCTYPE html> 
<html> 
<head> 
<base href="//polygit.org/components/"> 
<script src="webcomponentsjs/webcomponents.js"></script> 
<link rel="import" href="paper-material/paper-material.html"> 

<dom-module id="ui-firefox"> 
    <template>  
    <paper-material>Can you see me in Firefox?</paper-material> 
    </template> 
    <script> 
    Polymer({ 
     is: "ui-firefox", 
     ready: function(){ console.log("Am I ready?"); } 
    }); 
    </script> 
</dom-module> 

</head> 
<body> 
    <ui-firefox> </ui-firefox> 
</body> 
</html> 

这里提琴样本https://jsfiddle.net/s4oh43za/

我看了几个帖子,但事先我找不到解决方案,这个简单的例子
感谢,福斯托

回答

2

我的猜测是火狐以不同的方式加载HTML导入。

聚合物docs建议将dom-module脚本包装在HTMLImports.whenReady(function() {...})中,当它在index.html中定义时。按照该建议,您的jsfiddle的这一修改版本可以在Firefox和Chrome中使用。

+0

事实上,这么简单,有据可查。 还有很多要学习,但享受它 感谢一个很好的带我漂浮 –