当 DOM 元素在屏幕外渲染时,浏览器会执行哪些优化?

发布于 2024-08-14 00:22:56 字数 390 浏览 3 评论 0原文

我控制在另一个域上呈现的 iframe。是否有明确的方法来判断此 iframe 是在父页面的折叠上方还是下方呈现?显然,由于 同源策略 限制,我无法访问父 DOM。

例如,我尝试测量 canvasVML 标记上的渲染速度,希望当标记不在屏幕上时渲染速度会更快。但这不起作用——没有明显的速度差异。 DOM 操作也是如此 - 似乎没有办法区分折叠下方或上方的回流/重绘操作。

闪光灯呢?我没有太多经验,但是可以检查一下浏览器渲染 Flash 操作的速度吗?或者 Flash 是否有任何 DOM 标准之外的“不可见”事件?

I control an iframe being rendered on another domain. Is there a clear way of telling whether this iframe is being rendered above or below the fold on the parent page? Obviously, I can't access the parent DOM because of the same origin policy restriction.

For example, I tried measuring the speed of rendering on a canvas or VML tag, hoping it would be faster when the tag isn't on screen. This didn't work - there was no discernable speed difference. Ditto for DOM manipulation - there doesn't seem to be a way to differentiate between reflow/repaint operations below or above the fold.

What about flash? I don't have much experience, but could one check how quickly a browser renders flash operations? Or does flash have any 'onvisible' events outside of the DOM standard?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

冷︶言冷语的世界 2024-08-21 00:22:56

我不这么认为。

尽管您可以使用 url 参数(可以通过嵌入广告的 javascript 设置)到页面上的偏移量,但同源策略限制会阻止这种情况发生。

I don't think so.

The same origin policy restriction prevents that, although you can use url parameters, which can be set by the javascript embedding the ad, to the offset on the page.

聚集的泪 2024-08-21 00:22:56

SoundManager2 的作者 Scott Schiller 表示,根据 Flash 电影是否在屏幕上显示,JS->Flash 通信桥的延迟会略有不同。也就是说,当它不在屏幕上时,它会变慢。

According to the author of SoundManager2 Scott Schiller, there's a slight difference in the latency of the JS->Flash communication bridge depending on whether the flash movie is on screen or not. That is, it's slower when it is not on screen.

写下不归期 2024-08-21 00:22:56

这实际上因浏览器而异,因为不同的浏览器与 Flash 插件的交互方式不同。我能找到的最精确的解释是旧的 已连接的像素帖子

在撰写本文时,Firefox 直到 Flash 对象在页面上滚动时才初始化它。另一方面,IE 在 Stage 元素滚动到视图中时调整其大小。没有给出浏览器、Flash 或操作系统的版本,因此自该测试以来这可能已发生变化。

简而言之,我需要制作一个 Flash 对象并使用它,观察各种事件。

This really varies by-browser, as different browsers interact with the Flash plugin differently. The most precise explanation I could find is on an old connectedpixel post.

At the point of writing, Firefox didn't init a flash object until it was scrolled on page. IE, on the other hand, resized the Stage element when it scrolled into view. No versions of browser, Flash, or OS are given, so this may have changed since that test.

In short, I need to make a flash object and play with it, watching for various events.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文