Aaronius / penpal

A promise-based library for securely communicating with iframes via postMessage.
MIT License
381 stars 56 forks source link

replace document.contains to support shadow DOM #89

Closed yingjieg closed 2 years ago

yingjieg commented 2 years ago

I am using penpal in web component, but "document.contains()" can't detect iframe element in shadow DOM. To solve this issue, add this function to iterate the parentNode.

Aaronius commented 2 years ago

Thanks @yingjieg! Looks good. I plan on merging and publishing this later today.

Aaronius commented 2 years ago

@yingjieg it looks like you opened this PR against an old version of Penpal (4.x). This logic was changed in a later version. Please upgrade to the latest version to see if it fixes your issue and let me know if it doesn't. Thanks!

yingjieg commented 2 years ago

@Aaronius Thanks for your reply, I have tried iframe with web component in Penpal latest version, it works well. BR/Jie