Web Spec
约 1 分钟阅读
container-query
- Chrome 105+
const supportsContainerQueries = 'container' in document.documentElement.style;
if (!supportsContainerQueries) {
import('container-query-polyfill');
}@container (min-width: 200px) {
}- caniuse.com/css-container-queries
- GoogleChromeLabs/container-query-polyfillGitHubGoogleChromeLabs/container-query-polyfillChrome 105+ - LayoutNG M105 · mdn CSS Container Queries · 容器 · - · container-type: · size - inline-size + block-size · inline-size - 宽笔记:Container Query
- 不再维护,建议还是等待使用新版浏览器
- MutationObserver+ResizeObserver+
:is - Chrome/Edge 88+, Firefox 78+, Safari 14+
structuredClone
- Chrome 98+
- 支持 Map, Set, Date, RegExp, ArrayBuffer
- 支持 循环引用
const structuredClone = globalThis.structuredClone ?? (v)=>JSON.parse(JSON.stringify(v))EyeDropper API
async function sampleColorFromScreen(abortController) {
if ('EyeDropper' in window) {
return;
}
const eyeDropper = new EyeDropper();
try {
const result = await eyeDropper.open({ signal: abortController.signal });
return result.sRGBHex;
} catch (e) {
return null;
}
}关联信息
反向链接、本文链接的其他页面和外部资料。
参考资料
GitHub1 条
- GoogleChromeLabs/container-query-polyfillgithub.com/GoogleChromeLabs/container-query-polyfill
其他外链2 条
- caniuse.com/css-container-queriescaniuse.com/css-container-queries
- web.dev/eyedropperweb.dev/eyedropper