Я пытаюсь интегрировать Polymer с Rails 4, используя polymer-rails и polymer-paper-rails Драгоценные камни.
Кажется, у меня много проблем с отображением каких-либо элементов в Firefox. Оглядевшись вокруг и довольно много поискав в Google, я пришел к выводу, что проблема, должно быть, связана с моим файлом platfom.js
.
Я точно следовал инструкциям по установке обоих вышеупомянутых драгоценных камней и действительно не знаю, что я делаю неправильно. Бумажные элементы отлично работают в Google Chrome.
В моей консоли разработчика Firefox я вижу сообщение
«platform.js — не первый скрипт на странице. См. http://www.polymer-project.org/docs/start/platform.html#setup для получения подробной информации». платформа.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>
<%= javascript_include_tag 'polymer/platform' %>
вверху вашегоhead
, а не класть его в комплект звездочек (не идеальный вариант, но, по крайней мере, может помочь в диагностике) - person Nevir   schedule 14.10.2014mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
, и компоненты по-прежнему не отображаются правильно. - person HermannHH   schedule 14.10.2014title
. Вы должны либо переименовать атрибут, либо скачать версиюpolymer.js
для разработчиков. - person Aleksei Matiushkin   schedule 17.10.2014