聚合物在Firefox中无法正常工作

时间:2014-10-13 19:36:47

标签: ruby-on-rails firefox polymer web-component

我正在尝试使用the polymer-railspolymer-paper-rails Gems将Polymer与Rails 4结合使用。

我似乎在Firefox中显示任何元素时遇到了很多问题。在浏览了相当多的Google搜索后,我得出的结论是,platfom.js文件必定存在问题。

我已按照说明将上述宝石安装到信中,并且真的不知道我做错了什么。纸质元素在Google Chrome中完美运行。

在我的Firefox开发者控制台中,我看到了消息

  

“platform.js不是页面上的第一个脚本。请参阅   http://www.polymer-project.org/docs/start/platform.html#setup   详情。“platform.js:12”。

这是我的application.js文件的样子:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.

//= require jquery
//= require jquery_ujs
//= require foundation
//= require turbolinks
//= require_tree .
//= require elements/ripple
//= require forms/select

$(function(){ $(document).foundation(); });

我的HTML部分如下所示:

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title><%= content_for?(:title) ? yield(:title) : "foundation-rails" %></title>

    <%= javascript_include_tag 'polymer/platform' %>

    <%= stylesheet_link_tag    "application" %>
    <%= html_import_tag 'application'%>
    <%= javascript_include_tag "vendor/modernizr" %>
    <%= csrf_meta_tags %>
</head>

1 个答案:

答案 0 :(得分:0)

platform.js文档似乎已过时(与0.5版本的Polymer相关)

为了兼容不完全支持webcomponents的浏览器,您应该包括

//= require webcomponentsjs/webcomponents-lite

之后你应该看到FF / Safari中的组件与你在chrome中看到的相同