Does Jquery work well in quirks mode?

我与影子孤独终老i 提交于 2020-01-01 08:44:09

问题


For reasons beyond my control, the site works in quirks mode. Will Jquery help me in this situation?

I expect the jquery developers concentrate on strict mode today - the mode of the future. On the other hand, all those libraries once started to ease the pain of working in quirks mode.


回答1:


NO!

According to official jQuery site v. 1.8.1:

Don’t use Quirks mode! jQuery has never supported Quirks mode and we do not perform any testing in Quirks. This can affect values like $("window").height(), and the jQuery 1.8 Quirks mode results did change in order to support some modern browser features. The majority of problem cases we’ve seen are from developers that wanted to be in Standards mode but had an invalid doctype or extraneous markup before their tag. When in doubt, use the simple and short <!doctype html>.




回答2:


By some accounts, it works in quirks mode but the performance is horrible, see:

  • http://www.lostechies.com/blogs/johnteague/archive/2009/09/14/jquery-does-not-like-quirksmode.aspx
  • http://blog.yourinnovative.com/the-development-lab/jquery-quirks-mode-in-ie6/



回答3:


According to jQuery Migrate Plugin - Warning Messages

JQMIGRATE: jQuery is not compatible with Quirks Mode

Cause: A browser runs in "quirks mode" when the HTML document does not have a <!doctype ...> as its first non-blank line, or when the doctype in the file is invalid. This mode causes the browser to emulate 1990s-era (HTML3) behavior. In Internet Explorer, it also causes many high-performance APIs to be hidden in order to better emulate ancient browsers. jQuery has never been compatible with, or tested in, quirks mode.

Solution: Put a valid doctype in the document and ensure that the document is rendering in standards mode. The simplest valid doctype is the HTML5 one, which we highly recommend: <!doctype html> . The jQuery Migrate plugin does not attempt to fix issues related to quirks mode.



来源:https://stackoverflow.com/questions/1500353/does-jquery-work-well-in-quirks-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!