Skip to content

Commit

Permalink
Remove i-amphtml-element class on forced disconnect (ampproject#19858)
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell authored and cathyxz committed Dec 17, 2018
1 parent 97eebb1 commit 6dd51fe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/custom-element.js
Expand Up @@ -902,6 +902,15 @@ function createBaseCustomElementClass(win) {
if (!pretendDisconnected && dom.isConnectedNode(this)) {
return;
}

// This path only comes from Resource#disconnect, which deletes the
// Resource instance tied to this element. Therefore, it is no longer
// an AMP Element. But, DOM queries for i-amphtml-element assume that
// the element is tied to a Resource.
if (pretendDisconnected) {
this.classList.remove('i-amphtml-element');
}

this.isConnected_ = false;
this.getResources().remove(this);
if (isExperimentOn(this.ampdoc_.win, 'layers')) {
Expand Down

0 comments on commit 6dd51fe

Please sign in to comment.