diff --git a/src/declaration/polymer-element.js b/src/declaration/polymer-element.js
index 482c0301f5..076a984696 100644
--- a/src/declaration/polymer-element.js
+++ b/src/declaration/polymer-element.js
@@ -27,6 +27,8 @@
createdCallback: function() {
// fetch the element name
this.name = this.getAttribute('name');
+ // fetch our extendee name
+ this.extends = this.getAttribute('extends');
// install element definition, if ready
this.registerWhenReady();
},
@@ -35,8 +37,7 @@
if (this.waitingForPrototype(this.name)) {
return;
}
- // fetch our extendee name
- var extendee = this.getAttribute('extends');
+ var extendee = this.extends;
if (this.waitingForExtendee(extendee)) {
//console.warn(this.name + ': waitingForExtendee:' + extendee);
return;
diff --git a/src/declaration/prototype.js b/src/declaration/prototype.js
index 4b7c9b9803..8d5b4e7ee8 100644
--- a/src/declaration/prototype.js
+++ b/src/declaration/prototype.js
@@ -114,7 +114,7 @@
},
// build prototype combining extendee, Polymer base, and named api
generateBasePrototype: function(extnds) {
- var prototype = memoizedBases[extnds];
+ var prototype = this.findBasePrototype(extnds);
if (!prototype) {
// create a prototype based on tag-name extension
var prototype = HTMLElement.getPrototypeForTag(extnds);
@@ -125,6 +125,9 @@
}
return prototype;
},
+ findBasePrototype: function(name) {
+ return memoizedBases[name];
+ },
// install Polymer instance api into prototype chain, as needed
ensureBaseApi: function(prototype) {
if (!prototype.PolymerBase) {
@@ -153,8 +156,9 @@
prototype: this.prototype
}
// native element must be specified in extends
- if (extendee && extendee.indexOf('-') < 0) {
- info.extends = extendee;
+ var typeExtension = this.findTypeExtension(extendee);
+ if (typeExtension) {
+ info.extends = typeExtension;
}
// register the custom type
this.ctor = document.register(name, info);
@@ -162,6 +166,16 @@
this.prototype.constructor = this.ctor;
// register the prototype with HTMLElement for name lookup
HTMLElement.register(name, this.prototype);
+ },
+ findTypeExtension: function(name) {
+ if (name && name.indexOf('-') < 0) {
+ return name;
+ } else {
+ var p = this.findBasePrototype(name);
+ if (p.element) {
+ return this.findTypeExtension(p.element.extends);
+ }
+ }
}
};
diff --git a/test/html/element-registration.html b/test/html/element-registration.html
index bfb43962ce..9cfd683a17 100644
--- a/test/html/element-registration.html
+++ b/test/html/element-registration.html
@@ -31,6 +31,8 @@