自 Google Chrome v55(以及某些早期版本)起,默认启用对 OOPIF(多线程 iframe)的支持。这提供了 WebWorker 的许多优点,没有启动延迟,并且可以完全访问 DOM。
https://www.chromium.org/developers/design-documents/oop-iframes
https://github.com/optimalisatie/exec.js/tree/master/tests(OOPIF与 WebWorker)
Firefox、Internet Explorer、Opera 和/或 Safari 是否提供(或计划提供)类似的功能?
我读过有关 GeckoView 和 webview 的内容。看来 Firefox 一直致力于移动端的开发。
Intersection Observer V2 将引入新功能,以根据不透明度、z-index 和固定定位等因素检测实际能见度。
信息:https : //developers.google.com/web/updates/2019/02/intersectionobserver-v2
问题:是否有替代方法或 polyfill 来检测在当前浏览器中有效的实际可见性?
测试:https : //jsfiddle.net/v3kgewhf/
// Intersection Observer V2
const observer = new IntersectionObserver((changes) => {
for (const change of changes) {
// ?? Feature detection
if (typeof change.isVisible === 'undefined') {
// The browser doesn't support Intersection Observer v2, falling back to v1 behavior.
change.isVisible = true;
}
if (change.isIntersecting && change.isVisible) {
visibleSince = change.time;
} else {
visibleSince = 0;
}
}
}, {
threshold: [1.0], …Run Code Online (Sandbox Code Playgroud)