| <p>Test access to images inside forms as form element propertyies. Expected results match IE, because its behavior makes much more sense than Firefox one.</p> |
| <form><img id="bar"></form> |
| document.getElementById("log").innerHTML += msg + "<br>"; |
| log((result == eval(b)) ? ("PASS: '" + a + "' is '" + b + "'.") : ("FAIL: '" + a + "' should be '" + b + "', was '" + result + "'.")); |
| var imgFoo = document.createElement("img"); |
| var imgBar = document.body.getElementsByTagName("img")[0]; |
| var div = document.getElementById("div"); |
| imgFoo.setAttribute("id", "foo"); |
| document.forms[0].appendChild(imgFoo); |
| document.forms[0].appendChild(imgBar); |
| document.forms[1].appendChild(imgFoo); |
| shouldBe('document.forms[0].foo', 'undefined'); |
| shouldBe('document.forms[1].foo', 'imgFoo'); |
| document.forms[0].removeChild(imgBar); |
| shouldBe('document.forms[0].bar', 'undefined'); |
| // Don't leave a broken image icon in test results. |
| document.forms[1].removeChild(imgFoo); |