uzairfarooq / arrive

Watch for DOM elements creation and removal
MIT License
869 stars 99 forks source link

arrive.js with iframes? #32

Open DenisGorbachev opened 9 years ago

DenisGorbachev commented 9 years ago

I have a parent page that embeds a child iframe. I set up arrival listeners for elements in child iframe; however, these listeners are never called. Is it possible to use arrive.js with iframes?

P.S. I'm running google-chrome --disable-web-security to bypass same-origin checks.

uzairfarooq commented 9 years ago

Arrive won't fire for elements within an iframe unless you attach it to the document or some other element within an iframe. If you have access to the iframe then you can attach it to the document of iframe

DenisGorbachev commented 9 years ago

@uzairfarooq that's exactly what I am doing: attaching arrive to the iframe document. However, it doesn't work. Could you please chevk?

uzairfarooq commented 9 years ago

Hmm...haven't tried it before on iframe. Will look into it.

manuelmeurer commented 6 years ago

Hi @uzairfarooq, I'm also interested in this feature but can't get it to work. 😄 Anything I can do to help debug or implement this?

kylekyle commented 4 years ago

The monitoring package is a rewrite of arrive and can watch for elements in iframes:

const monitor = monitoring(document.body, {iframes: true});

monitor.added('div', div => {
  if (div.ownerDocument != document) {
    console.log('new div in an iframe!');
  }
});

Disclosure: I am the author of monitoring.