Skip to content

Commit

Permalink
Only attach internal classNames to elements not in templates (ampproj…
Browse files Browse the repository at this point in the history
  • Loading branch information
cvializ authored and Enriqe committed Nov 28, 2018
1 parent 317a479 commit efda717
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/custom-element.js
Expand Up @@ -735,6 +735,13 @@ function createBaseCustomElementClass(win) {
* @final @this {!Element}
*/
connectedCallback() {
if (!isTemplateTagSupported() && this.isInTemplate_ === undefined) {
this.isInTemplate_ = !!dom.closestByTag(this, 'template');
}
if (this.isInTemplate_) {
return;
}

if (this.isConnected_ || !dom.isConnectedNode(this)) {
return;
}
Expand All @@ -746,12 +753,6 @@ function createBaseCustomElementClass(win) {
this.classList.add('amp-notbuilt');
}

if (!isTemplateTagSupported() && this.isInTemplate_ === undefined) {
this.isInTemplate_ = !!dom.closestByTag(this, 'template');
}
if (this.isInTemplate_) {
return;
}
if (!this.ampdoc_) {
// Ampdoc can now be initialized.
const win = toWin(this.ownerDocument.defaultView);
Expand Down

0 comments on commit efda717

Please sign in to comment.