javascript - I have error document.registerElement underfined - Stack Overflow

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

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

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

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

My Bower:

{
  "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"
  }
}

And my page:

<!DOCTYPE html>
<html>
<head>
    <link rel="import" href="/client/polymer-0.5.2/bower_ponents/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>

What's wrong? I took this from the example in the documentation. Here .html#autobinding

PS: Browser IE11

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

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

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

My Bower:

{
  "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"
  }
}

And my page:

<!DOCTYPE html>
<html>
<head>
    <link rel="import" href="/client/polymer-0.5.2/bower_ponents/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>

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

PS: Browser IE11

Share asked Jan 3, 2015 at 3:13 nimnim 3281 gold badge5 silver badges16 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

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.

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744810168a4595009.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信