舊文件

此處文件僅供參考,請自行考量時效性與適用程度,其他庫藏文件請參考文件頁面
我們亟需您的協助,進行共筆系統搬移、及文件整理工作,詳情請查閱參與我們

Error tolerance and quirk mode (en)

出自 MozTW Wiki

於 2010年3月26日 (五) 11:57 由 Irvin對話 | 貢獻 所做的修訂 (回降到Softcup的最後一次編輯)
(比較) ←上一修訂 | 查看目前修訂 (比較) | 下一修訂→ (比較)

譯文:容錯與 quirk 模式

One of the hallmarks of Microsoft Internet Explorer (IE), besides security problems, has been error tolerance. In fact, this is also true to the Microsoft Windows development platform. To many developers, error tolerance has been a blessing. Unfortunately, to some developers, especially the platform designers themselves, this is also a nightmare.

Many users have asked why Mozilla (and Firefox) can't be like Internet Explorer (IE) in being more error tolerant. If Mozilla can handle poorly-coded Web pages more gracefully, they reason, there will be less problem sites and more Mozilla adoption. However, technology-wise this is both impossible and undesirable.

In the Web development circle, we call browser layout behaviors that do not confirm to standards "quirks". These could be either bugs or by design (features for backward-compatibility or error tolerance). They are mostly undocumented and nearly impossible to distinguish. Given IE's market dominance, many developers and user take all IE quirks (bugs included) as all features.

The nature of these quirks make imitating IE impossible. There is no standard on how to handle poorly coded Web pages and, without access to each others' source code, developers cannot write software that handle these pages the same way. I can just throw in a random, unsophisticated example:

  <b>
    <p><li>
      <font color=red>paragraph
        <div style="position:absolute;top:10px;right:10px;color:blue">
        blah
    </p>
      </font>
    blah
  </b>
    blah
         </div>

and get a different results in different browsers (even among different IE versions themselves). In addition, all software have bugs, and it's difficult to determine if a layout quirk is unintended or due to guesswork on a possible mistake in a Web page. Browser developers can at best emulate (known) quirks, which is never precise.

Being overtly error tolerant is also undesirable. One reason why pre-Windows XP SP2 machines have so many security vulnerabilities is because the platforms make it easy for developers to do things, including things that they shouldn't. In other words, Windows were error tolerant. Service pack 2 caused a lot of buzz not only because it fixes things, but also because it breaks things (existing software).

Being error tolerant (or backward-compatible) may have the short term advantage of drawing new developers, but it does at the cost of long term development. Internet Explorer suffers the same fate. Because the browser is so overloaded with code designed for "bad code", its development is hindered. In fact, in the [BetaNews Interview|interview between BetaNews and the director of Windows Product Management], backward compatibility is cited as a reason to why further development on IE is difficult.

In conclusion, Web developers should not expect Mozilla or any browser to handle poorly-coded Web pages "the way they should" (which cannot be defined). Doing so will only lock the Web developers in archaic technologies.

個人工具