ant-design/components/_util/styleChecker.tsx
偏右 fc5e0a9155
test: 100% coverage (#26839)
* test: isStyleSupport

* test: 100% test coverage
2020-09-21 18:32:24 +08:00

12 lines
484 B
TypeScript

export const isStyleSupport = (styleName: string | Array<string>): boolean => {
if (typeof window !== 'undefined' && window.document && window.document.documentElement) {
const styleNameList = Array.isArray(styleName) ? styleName : [styleName];
const { documentElement } = window.document;
return styleNameList.some(name => name in documentElement.style);
}
return false;
};
export const isFlexSupported = isStyleSupport(['flex', 'webkitFlex', 'Flex', 'msFlex']);