本文介绍了为什么Internet Explorer需要“hasLayout”旗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

像许多开发者在网站上使用Internet Explorer一样,我似乎遇到了许多由臭名昭着的。

Like many developers working on web sites for Internet Explorer, I seem to come across a lot of bugs that are caused by the notorious hasLayout flag.

我明白这个标志做什么,它是如何工作的(大部分)。一个很好的解释我读的另一天(虽然我找不到源)是 hasLayout 在IE中基本上意味着使这个元素一个矩形。

I understand what this flag does and how it works (for the most part). A good explanation I read the other day (although I can't find the source) is that hasLayout in IE essentially means "Make this element a rectangle."

这显然比这更复杂,但很好地总结了这一点(在我看来)。

It's obviously more complicated than that, but it's pretty well summed up with that (in my opinion).

不明白是为什么浏览器使用这个标志。当找到一个答案,我发现一个听起来合乎逻辑:

What I don't understand is why the browser uses this flag. When looking for an answer, I found one that sounded logical:

这对我来说几乎是有意义的,直到我意识到Firefox )不得不处理同样的问题。 Netscape已经存在几乎只要Internet Explorer,但它不需要任何内部 hasLayout 标志,或任何类似,据我所知。

This almost made sense to me, until I realized that Firefox (Netscape at the time) had to deal with the same problem. Netscape has been around for pretty much as long as Internet Explorer, however it doesn't need any internal hasLayout flag, or anything similar,as far as I know.

看到 hasLayout 标志是如何在Internet Explorer中的许多错误的来源,有没有人知道为什么IE有这个标志和其他浏览器不需要它?

Seeing as how the hasLayout flag is the source of so many bugs in Internet Explorer, does anyone know why IE has this flag and other browsers don't need it?

这是我想知道纯粹出于好奇,如果任何人有任何理论或恰好知道答案。我想更多地了解为什么(或为什么不)这个标志是有用的。

This is something I'd like to know purely out of curiosity if anyone has any theories or happens to know the answer. I'd like to understand more about why (or why not) this flag is useful.

推荐答案

Netscape渲染器完全重新写后NS4。 IE的Trident渲染引擎没有这样的爱。此 - IE在重写期间持续提高增量,部分是因为这一点(并且部分是因为它的分配安排...)设法捕获市场的巨大份额...

The Netscape renderer was completely re-written post-NS4. IE's "Trident" rendering engine got no such love. This made good business sense - IE continued to improve incrementally while NS was being re-written, and partially because of this (and partially because of its distribution arrangement...) managed to capture a huge share of the market...

但最终结果是一个旧的,繁琐的代码库,为开发人员带来了生命,因此必须痛苦地意识到应该隐藏的实现细节。

But the end result is an old, crufty codebase which makes life hell for developers, who must consequently be painfully aware of what should be hidden implementation details.

最后一点是关键:浏览器的渲染器是一个抽象,允许您在几行标记中创建一些东西,这将需要数百或数千行低级渲染和事件处理代码。像所有的编程抽象,它泄漏一点...这是真的IE,Netscape,Firefox,Opera,Webkit ...每个浏览器都有以堵塞抽象中的泄漏。除了五年,IE没有。 其他泄漏已被插入,但呈现引擎变得越来越像筛子。

Now, that last point is key: a browser's renderer is an abstraction, allowing you to create in a few lines of markup something that would take hundreds or thousands of lines of low-level rendering and event-handling code. And like all programming abstractions, it leaks a bit... This is true for IE, Netscape, Firefox, Opera, Webkit... And each browser has developers working feverishly to plug the leaks in the abstractions. Except, for five years, IE did not. Other leaks were plugged, but the rendering engine became more and more sieve-like.

这些因素共同导致暴露 hasLayout

Together, these to factors conspire to expose things like hasLayout.

这篇关于为什么Internet Explorer需要“hasLayout”旗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 09:46