MCPcopy Create free account
hub / github.com/ampproject/amphtml / isDescendantWindow

Function isDescendantWindow

src/iframe-helper.js:140–147  ·  view source on GitHub ↗

* Checks whether one window is a descendant of another by climbing * the parent chain. * @param {?Window} ancestor potential ancestor window * @param {?Window} descendant potential descendant window * @return {boolean}

(ancestor, descendant)

Source from the content-addressed store, hash-verified

138 * @return {boolean}
139 */
140function isDescendantWindow(ancestor, descendant) {
141 for (let win = descendant; win && win != win.parent; win = win.parent) {
142 if (win == ancestor) {
143 return true;
144 }
145 }
146 return false;
147}
148
149/**
150 * Removes any listenFors registered on listenSentinel that do not have

Callers 1

getListenForEventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected