diff --git a/src/instance/base.js b/src/instance/base.js index 131975c5fe..957d52f3d5 100644 --- a/src/instance/base.js +++ b/src/instance/base.js @@ -36,10 +36,12 @@ this.takeAttributes(); // add event listeners this.addHostListeners(); - // guarantees that while preparing, any sub-elements will also be prepared + // guarantees that while preparing, any + // sub-elements are also prepared preparingElements++; // process declarative resources this.parseDeclarations(this.__proto__); + // decrement semaphore preparingElements--; // user entry point this.ready(); @@ -88,7 +90,14 @@ }, // parse input as needed, override for custom behavior parseDeclaration: function(elementElement) { - this.shadowFromTemplate(this.fetchTemplate(elementElement)); + var template = this.fetchTemplate(elementElement); + if (template) { + if (this.element.hasAttribute('lightdom')) { + this.lightFromTemplate(template); + } else { + this.shadowFromTemplate(template); + } + } }, // return a shadow-root template (if desired), override for custom behavior fetchTemplate: function(elementElement) { @@ -117,6 +126,22 @@ return root; } }, + // utility function that stamps a