react-component / util

Common Utils For React Component
util.vercel.app
MIT License
628 stars 178 forks source link

"Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" #481

Open javanoclaw opened 11 months ago

javanoclaw commented 11 months ago

I found some compatibility issues in Firefox browser.

Environment Browser: Firefox 60.7.0esr (64 bit) Browser download link: ftp.mozilla.org/pub/firefox/releases/60.7.0esr/

I try use these codes to fix this issues:

var _getComputedStyle = getComputedStyle(target, '::-webkit-scrollbar');
var width = '0px';
var height = '0px';
try {
    width = _getComputedStyle.width,
    height = _getComputedStyle.height;
}catch(e) {
    width = '0px';
    height = '0px';
}

Can these codes be merged into the master branch?

zhenghangjie commented 4 months ago

getComputedStyle(document.body, '::-webkit-scrollbar');

  1. 这个伪类 ::-webkit-scrollbar 在 Firefox 上不支持(非标)
  2. 在 Firefox 62 之前,视窗上未展示的元素(Window with no presentation) getComputedStyle 返回的是 null

所以出现这种声明了要匹配的伪元素的字符串反而被浏览器识别为元素不存在,返回了 null https://bugzilla.mozilla.org/show_bug.cgi?id=1467722 https://bugzilla.mozilla.org/show_bug.cgi?id=1471231

image image