Custom element error - "Element name could not be inferred"

611 views
Skip to first unread message

kman...@gmail.com

unread,
Dec 4, 2014, 7:13:14 AM12/4/14
to polym...@googlegroups.com
Getting a naming error when using custom element

<link rel="import" href="../../bower_components/firebase-element/firebase-element.html">
<script src="firebase-as-array.js"></script>
<polymer-element name="firebase-list" attributes="list" extends="firebase-element">
 
<script>
   
(function () {
     
'use strict';


     
Polymer('firebase-list', {
        refChanged
: function() {
         
this.list = Firebase.getAsArray(this.ref);
       
}
     
});


   
})();
 
</script>
</polymer-element>

Using it

<body unresolved>
 
<h1>Hello World</h1>
 
<template is="auto-binding">
   
<firebase-element location="https://fire-people.firebaseio.com/" ref="{{ref}}"/>
   
<firebase-list id="people" ref="{{ref}}" list="{{list}}"></firebase-list>



Why!?
Caused by this function in Polymer...

  // imperative implementation: Polymer()


 
// specify an 'own' prototype for tag `name`
 
function element(name, prototype) {
   
if (typeof name !== 'string') {
     
var script = prototype || document._currentScript;
      prototype
= name;
      name
= script && script.parentNode && script.parentNode.getAttribute ?
          script
.parentNode.getAttribute('name') : '';
     
if (!name) {
       
throw 'Element name could not be inferred.';
     
}
   
}

kman...@gmail.com

unread,
Dec 4, 2014, 7:37:01 AM12/4/14
to polym...@googlegroups.com, kman...@gmail.com
Turns out that the problem was not with the fire-base element, but with more functions config in my index.html. 
Somehow I had gotten the notion, that I should wrap my application wide functions in a Polymer() contstructor as well. This in turn created an "unnamed application custom element", and so I got that mysterious error.
Reply all
Reply to author
Forward
0 new messages