Document Object Attributes: documentmode and compatmode

Source: Internet
Author: User

Doctype

Doctype Full name: Document Type Declaration (document type declaration, abbreviated to DTD)

The declaration of DTD affects the browser's parsing of CSS code and JavaScript scripts.

Rendering Mode

Rendering modes include mixed mode, near standard mode, and standard mode

Except for IE6/7, the standard mode is not supported. all browsers in other modes support this mode;

Relationship between docytpe and rendering Mode

1. hybrid mode: Do not write the doctype Declaration;

2. Close to standard mode: HTML declaration of Transition type (Transitional) or framework type (frameset) and XHTML declaration of Transition type or framework type;

3. Standard mode: HTML5 doctype declaration and strict HTML declaration and strict XHTML Declaration;

Other scenarios where hybrid mode is activated:

The following content appears before the doctype Declaration: plain text, HTML Tag, HTML annotation, XML declaration, and IE condition annotation.

Use js to determine the current browser mode:

Document. compatmode = 'css1compat '? 'Standard mode': 'Mixed mode ';

IE, Firefox, opera, sarari, and chrome all implement this attribute;

Special situations of IE8:

IE8 introduces a new attribute named documentmode for the document object, because IE8 has three different rendering modes. If the value of this attribute is 5, it indicates the hybrid mode (ie 5 mode); if it is 7, it indicates the IE7 simulation mode; if it is 8, it indicates the IE8 standard mode.

Support in IE8 +

Reference: http://hi.baidu.com/flondon/item/4da1a01c3885967f7b5f2598

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.