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 understand that at this point, this project seems to be no longer maintained. But I just want to point out, the code seems only work in Chrome (8/2019), which makes it a bit pointless because Chrome natively supports ResizeObserver. Firefox 68 and Edge (the non-chromium one) currently doesn't support ResizeObserver and this workaround also doesn't work with the two browsers. Here is my code in case I used in incorrectly:
<!doctype html><html><head><metacharset="utf-8" /><title>Why it doesn't work</title></head><body><divclass='dummy'>This is the content that will be resized.</div><style>
.dummy {
width:100%;
background: red;
position: relative;
}
</style><script>constCSS=`position:absolute;left:0;top:-100%;width:100%;height:100%;margin:1px 0 0;border:none;opacity:0;pointer-events:none;`;functionobserve(element,handler){constframe=document.createElement('iframe');constsupportsPE=document.documentMode<11&&'pointerEvents'inframe.style;frame.style.cssText=`${CSS}${supportsPE ? '' : 'visibility:hidden;'}`;frame.onload=()=>{frame.contentWindow.onresize=()=>{handler(element);};};element.appendChild(frame);returnframe;};observe(document.querySelector('.dummy'),function(){console.log('dummy: resized!');});</script></body></html>
The text was updated successfully, but these errors were encountered:
Same problem. I researched problem and find out the reason. In FF the next string return false: const supportsPE = document.documentMode < 11 && 'pointerEvents' in frame.style;
because document.documentMode is undefined
so supportsPE == false and string added 'visibility:hidden;' frame.style.cssText = ${CSS}${supportsPE ? '' : 'visibility:hidden;'};
I understand that at this point, this project seems to be no longer maintained. But I just want to point out, the code seems only work in Chrome (8/2019), which makes it a bit pointless because Chrome natively supports ResizeObserver. Firefox 68 and Edge (the non-chromium one) currently doesn't support ResizeObserver and this workaround also doesn't work with the two browsers. Here is my code in case I used in incorrectly:
The text was updated successfully, but these errors were encountered: