HTML and CSS Reference
In-Depth Information
If you've ever struggled with writing JavaScript code that works the same across browsers, you know how
annoying these cross-browser idiosyncrasies can be.
By contrast, a well-formed document removes the ambiguity by requiring all the end-tags to be filled in and all
the elements to have a single unique parent. Here is the well-formed markup corresponding to the preceding
code:
<p>...foo<strong>...</strong></p> <p><strong>...bar</strong> </p>
This leaves no room for browser interpretation. All modern browsers build the same tree structure from this
well-formed markup. They may still differ in which methods they provide in their respective DOMs and in other
aspects of behavior, but at least they can agree on what's in the HTML document. That's a huge step forward.
Anything that operates on an HTML document, be it a browser, a CSS stylesheet, an XSL transformation, a
JavaScript program, or something else, will have an easier time working with a well-formed document than the
malformed alternative. For many use cases such as XSLT, this may be critical. An XSLT processor will simply
refuse to operate on malformed input. You must make the document well-formed before you can apply an XSLT
stylesheet to it.
Most web sites will need to make at least some and possibly all of the following fixes to become well-formed.
Search WWH ::




Custom Search