@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
20 lines (18 loc) • 618 B
JavaScript
'use client';
let node = null;
let cachedHasComputedStyleMapSupport;
/**
* Detect if Element: computedStyleMap() is supported as a more performant
* alternative to getComputedStyles()
* Only Firefox does not have support as of Nov 2024.
* https://developer.mozilla.org/en-US/docs/Web/API/Element/computedStyleMap
*/
export function hasComputedStyleMapSupport() {
if (node == null) {
node = document.createElement('div');
}
if (cachedHasComputedStyleMapSupport === undefined) {
cachedHasComputedStyleMapSupport = node.computedStyleMap !== undefined;
}
return cachedHasComputedStyleMapSupport;
}