You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an iframe in a shadow dom. (using stencil-js)
I create iFrameResize with the DOM object instead of "css selector" and everything works as expected, except when resizing the main window.
The problem is the use of document.getElementById instead of using the "iframe" object in the iFrameResize settings (iFrameReadyMsgReceived, sendTriggerMsg functions).
function iFrameReadyMsgReceived() {
// eslint-disable-next-line no-restricted-syntax, guard-for-in
for (var iframeId in settings) {
trigger(
'iFrame requested init',
createOutgoingMsg(iframeId),
document.getElementById(iframeId),
iframeId
)
}
}
function sendTriggerMsg(eventName, event) {
function isIFrameResizeEnabled(iframeId) {
return (
settings[iframeId] &&
'parent' === settings[iframeId].resizeFrom &&
settings[iframeId].autoResize &&
!settings[iframeId].firstRun
)
}
Object.keys(settings).forEach(function(iframeId) {
if (isIFrameResizeEnabled(iframeId)) {
trigger(eventName, event, document.getElementById(iframeId), iframeId)
}
})
}
My fix is to get the "iframe" object in the settings object instead of trying to get the DOM from the document.
I'm going to create a pull request to fix it, but would there be any reasons to use getElementById?
If not we can always get it directly from settings[iframeId].iframe
The text was updated successfully, but these errors were encountered:
But like I wrote in the pull request comment... I spent the last day to try to test it with your automated tests. I don't push the compiled version (only the src modification)
I have an iframe in a shadow dom. (using stencil-js)
I create iFrameResize with the DOM object instead of "css selector" and everything works as expected, except when resizing the main window.
The problem is the use of document.getElementById instead of using the "iframe" object in the iFrameResize settings (iFrameReadyMsgReceived, sendTriggerMsg functions).
My fix is to get the "iframe" object in the settings object instead of trying to get the DOM from the document.
I'm going to create a pull request to fix it, but would there be any reasons to use getElementById?
If not we can always get it directly from settings[iframeId].iframe
The text was updated successfully, but these errors were encountered: