JavaScript运行时错误:对象不支持属性或方法“registerElement”
在档案里:..。bower_components\polymer\polymer.js 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
PS:浏览器IE11
发布于 2015-01-03 03:53:45
目前只有Chrome和其他基于闪烁的浏览器支持自定义元素。Firefox支持但不支持defualt。
有关完整的支持图,请参见Can I Use。
如果您在其他浏览器上使用它,则需要包含一个Web组件 polyfill (通常是一个名为webcomponents.js的文件)。
https://stackoverflow.com/questions/27751373
复制相似问题