Comments (6)
Firefox 60,遇到同样的问题。自己写了一个 Proxy,凑合用
const ua = navigator.userAgent;
const m = ua.match(/Firefox\/(\d+)/i);
if (m && parseInt(m[1]) <= 60) {
const _getComputedStyle = getComputedStyle;
const handler = {
get: function (obj: any, prop: string) {
try {
return obj[prop];
} catch (e) {
console.log("catch getComputedStyle error", e);
/**
* 如果是 width 或者 height,需要返回字符串,因为 rc-util 直接对接过进行正则匹配,返回空会报错
* https://github.com/react-component/util/blob/780a217fc67a15fc1f9170c107df001b21975f5e/src/getScrollBarSize.tsx#L57
*/
if (prop == "width" || prop == "height") return "";
else return undefined;
}
},
};
window.getComputedStyle = (
elt: Element,
pseudoElt?: string | null | undefined
): CSSStyleDeclaration => {
return new Proxy(_getComputedStyle(elt, pseudoElt), handler);
};
console.log("Firefox 60 以下版本,替换 getComputedStyle 完成");
}
from util.
from util.
在较新的浏览器上CSSStyleDeclaration稳定地表现为对象,但是在Firefox较早版本里表现飘忽不定,表现更像是一个数组,但是在偶然情况下又表现为一个对象,具体在什么场景下表现为什么还没有找到规律
from util.
看了一下 -webkit-scrollbar
是有兼容性的问题,但是时好时坏这个……
from util.
+1
from util.
win 10 firefox 52.0.2 下也有问题
from util.
Related Issues (20)
- [RFC] tsconfig 是否应该开启 strict 或 strictNullChecks HOT 1
- useMobile hooks in version v5.28.0
- isVisible failing with element from a different window
- Calling utils.merge that have the same object does not work HOT 1
- switchScrollingEffect.js 的代码是否存在问题?
- Function isDom not working inside iframe HOT 1
- vite/[email protected]: error message occurred does not provide an export named 'isFragment' HOT 2
- function inShadow throws error when shadowRoot is undefined HOT 1
- "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" HOT 1
- Fix ESM exports
- 【CSP once is not effective 】util/src/Dom/dynamicCSS injectCSS function with csp bug,Style.once is not effective HOT 2
- getContainer 咨询
- 目前的导出模式无法实现自动切换 CommonJS 和 ESModule 导入
- father 默认兼容 ie11 导致构建尺寸偏大
- Do we have any component from DnD?
- Bug: proxyObject prevents the element from changing its value
- "render" function throws "reactRender is not a function" with react 19-rc HOT 2
- injectCSS throw `This document requires 'TrustedHTML' assignment.`
- Warning: findDOMNode is deprecated and will be removed in the next major release HOT 3
- PureRenderMixin BSD+Patent license issues
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from util.