Skip to content

Commit

Permalink
Exposing meta tags from attachShadowDoc (ampproject#22735)
Browse files Browse the repository at this point in the history
* exposing meta tags from attachShadowDoc

* exposes doc head via attachDoc in shadow mode

* removed copying meta
  • Loading branch information
prateekbh authored Jun 25, 2019
1 parent 4cd544b commit 2fc25dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ export class MultidocManager {
mergeShadowHead_(ampdoc, shadowRoot, doc) {
const extensionIds = [];
if (doc.head) {
shadowRoot.AMP.head = doc.head;
const parentLinks = {};
const links = childElementsByTag(
dev().assertElement(this.win.document.head),
Expand Down
7 changes: 7 additions & 0 deletions test/unit/test-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,13 @@ describes.realWin(
expect(viewer.getVisibilityState()).to.equal('inactive');
expect(viewer.dispose).to.be.calledOnce;
});

it('should expose head tag ', () => {
const amp = win.AMP.attachShadowDoc(hostElement, importDoc, docUrl);
expect(amp.head).to.exist;
expect(amp.head.children).to.exist;
expect(amp.head.children.length).to.greaterThan(0);
});
});

describe
Expand Down

0 comments on commit 2fc25dc

Please sign in to comment.