]> Test of extra stuff

Custom DTD test page

This test page shows how to extend the XHTML DTDs to include custom attributes. This page also shows the main browser problem.

This paragraph has an attribute behavior="mouseover". Normally the W3C validator would not declare this page valid, but because of the custom DTD it now accepts this extra attribute. Try it.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
[
<!ATTLIST p behavior CDATA #IMPLIED>
]>

The extra <!ATTLIST p behavior CDATA #IMPLIED> tells the validator that in this document the <p> elements may have an attribute behavior.

The problem

Unfortunately, though the validator accepts the page, the browsers don't. With the exception of Opera they think that the > of the !ATTLIST closes the entire <!DOCTYPE> tag. This is not illogical: of old browsers weren't equipped to handle nested tags.

The result is unpleasant though: all browsers but Opera start this page with:

]>

To me this is a bug: browsers should be able to read such customized doctypes.