fieldset comparisson

No easy to find documented, but the requirement of a <legend> child inside a form <fieldset> has changed between HTML 4.01 spec & HTML 5 spec. This is evidenced by running the following two basic documents through the W3C validator! http://validator.w3.org/

by kpowz

HTML

<!-- http://validator.w3.org -->
<!--Invalid/does not validate without legend elements-->
<!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
     "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
 <title>HTML Fieldset</title>
</head>
<body>-->
<h1>Validates w/ 4.01 DOCTYPE</h1>
<form action="submit">
    <fieldset>
        <legend>fieldset 1</legend>
        <!-- TODO: controls here -->
    </fieldset>
    <fieldset>
        <legend>fieldset 2</legend>
        <!-- TODO: controls here -->
    </fieldset>
</form>
<!--</body>
</html> -->

<h1>Invalid w/ 4.01 DOCTYPE</h1>
<form action="submit">
    <fieldset>
        <span>no legend</span>
    </fieldset>
    <fieldset>
        <legend>fieldset 2</legend>
        <!-- TODO: controls here -->
    </fieldset>
</form>

<h1>Invalid w/ 4.01 DOCTYPE</h1>
<form action="submit">
    <fieldset>
        <legend>fieldset 1</legend>
        <!-- TODO: controls here -->
        <fieldset>
            <legend>fieldset 1-1</legend>
            <span>nested fieldset</span>
        </fieldset>
    </fieldset>
    <fieldset>
        <legend>fieldset 2</legend>
        <!-- TODO: controls here -->
    </fieldset>
</form>

<!--Validates without legend elements & with nested fieldsets-->
<!--<!DOCTYPE html>
<html lang="en-US">
    <head>
        <meta charset="utf-8">
        <title>HTML Fieldset</title>
    </head>
    <body>-->
        <h1>Validates w/ 5 DOCTYPE</h1>
        <form action="submit">
            <fieldset>
                <span>no legend</span>
                <!-- TODO: controls here -->
                <fieldset><span>nested fieldset</span></fieldset>
            </fieldset>
            <fieldset>
                <span>no legend</span>
                <!-- TODO: controls here -->
            </fieldset>
        </form>
<!--    </body>
</html> -->