chromium/third_party/blink/web_tests/fast/forms/form-attribute-nonexistence-form-id.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<form id="form">
    <input type="hidden" id="input1" value="value1">
    <input type="hidden" id="input2" value="value2" form="X">
    <label id="label1">label1</label>
    <label id="label2" form="X">label2</label>
</form>
<div id="console"></div>
<script>
description('This page ensures that &lt;input from="X"&gt; and &lt;label from="X"&gt; don\'t associate with any form elements when there is no &lt;form id="X"&gt;.');

var form = document.getElementById('form');
var inputShouldHaveForm = document.getElementById('input1');
var inputShouldNotHaveForm = document.getElementById('input2');
var labelWithoutForm = document.getElementById('label1');
var labelWithInvalidForm = document.getElementById('label2');
shouldBe('inputShouldHaveForm.form', 'form');
shouldBeNull('inputShouldNotHaveForm.form');
shouldBeNull('labelWithoutForm.form');
shouldBeNull('labelWithInvalidForm.form');
</script>
</body>
</html>