HTML5 parsing Rule Analysis

Source: Internet
Author: User

Comments: One of the successes of the HTML 5 Recommendation standards is to provide a detailed specification to illustrate how to parse HTML documents. For a long time, browser providers have tried to guess and copy the implementations of other browsers, hoping that their parser will not produce too many problems when processing HTML documents. Although some parts of HTML 5 are currently highly controversial, the parsing part is recognized by browser vendors. Once the browser starts to implement it, users can benefit from the increased compatibility.

One of the initial implementations of HTML 5 parsing rules was developed to support the HTML 5 validator. (If you want to test this validator, The http://ejohn.org should be legal HTML 5 .) This implementation is developed in Java and provides interfaces of SAX and DOM, and is open-source.

Interestingly, Henri Sivonen (author of the validator) recently developed a brand new HTML 5 parsing engine for Gecko, which will be used in the next version of Firefox.

This implementation is actually completed by automatically converting the Java Implementation of Henri's HTML 5 parser to C ++. This conversion is automatically completed, and all changes will be submitted to the Mozilla code base.

In general, I will jump out when it comes to this large-scale procedural method of converting the Java code library to C ++. However, the results were surprising: The page loading performance increased by 3%.

These are based on a series of bug fixes and consistency checks provided by the code library. You can view the patch progress in the Mozilla bug library.

If you want to try a new Parser (You are unlikely to find many significant changes, but any effort to find Bugs is appreciated .), Download a daily Firefox build version, open about: config, and set html5.enable to true.

If you want to upgrade to HTML 5, now is the time. Because HTML 5 is a superset of functions provided by HTML 4 and XHTML 1, it is very easy to upgrade. You only need to replace the current (X) HTML document type declaration with the HTML 5 document type.



<! DOCTYPE html> you can find details on how to make the new HTML 5 elements work on all browsers from the HTML 5 Doctor website.

Related Article

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.