我有错误的document.registerElement underfined [英] I have error document.registerElement underfined

查看:172
本文介绍了我有错误的document.registerElement underfined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JavaScript运行时错误:对象不支持文件中的属性或方法'registerElement'

JavaScript runtime error: Object doesn't support property or method 'registerElement'

:... bower_components\polymer\polymer.js第11701行

in File: ... bower_components\polymer\polymer.js Line 11701

  document.registerElement('polymer-element', {prototype: prototype});

我的凉亭:

{
  "name": "Polymer",
  "version": "0.0.0",
  "main": "main",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "polymer": "Polymer/polymer#~0.5.2",
    "core-icons": "Polymer/core-icons#~0.5.2",
    "core-elements": "Polymer/core-elements#~0.5.2",
    "paper-elements": "Polymer/paper-elements#~0.5.2"
  }
}

和我的页面:

<!DOCTYPE html>
<html>
<head>
    <link rel="import" href="/client/polymer-0.5.2/bower_components/polymer/polymer.html">
</head>
<body>
    <!-- render data set -->
  <template id="auto-bind-demo" is="auto-binding" repeat="{{quotes}}">
    <div on-tap="{{quoteClicked}}">
      <h3>{{quote}}</h3>
      - <em>{{attribution}}</em>
    </div>
  </template>

  <script>
    var t = document.querySelector('#auto-bind-demo');
    t.quoteClicked = function() {
      alert('Quote clicked!');
    };
    t.quotes = [{ 
      attribution: 'Plautus', 
      quote: 'Let deeds match words.'
    }, { 
      attribution: 'Groucho Marx',
      quote: 'Time flies like an arrow. Fruit flies like a banana.'
    }];
  </script>
</body>
</html>

怎么了?我从文档中的示例中获取了这个。 https://www.polymer-project.org/docs/ polymer / databinding-advanced.html #autobinding

What's wrong? I took this from the example in the documentation. Here https://www.polymer-project.org/docs/polymer/databinding-advanced.html#autobinding

PS:浏览器IE11

PS: Browser IE11

推荐答案

目前只有Chrome和其他基于blink的浏览器支持自定义元素。 Firefox支持但不支持defualt。

Currently only Chrome and other blink-based browsers support Custom Elements. Firefox supports but not enabled by defualt.

请参阅 我可以使用 获取完整的支持图表。

See Can I Use for a full supporting chart.

如果您在其他浏览器上使用它,则需要包含网页组件 polyfill (通常是名为 webcomponents.js 的文件)。

If you are using it on other browsers, you need to include a Web Components polyfill (usually a file named webcomponents.js).

这篇关于我有错误的document.registerElement underfined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆