2016-05-25 44 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

事實上,這麼簡單,有據可查。 還有很多要學習,但享受它 感謝一個很好的帶我漂浮 –