blob: c642a4612c308bb49f9fc190fb97d5b6f5279cde [file] [log] [blame]
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.waitUntilDone();
</script>
</head>
<body>
<p id="description">
This test checks that an attribute is not removed when set to the initial value of an &lt;input&gt; tag
using <span style="font-family: monospace;">setAttribute()</span>.
If the test passes, you will see a list of <span class="pass" style="font-family: monospace;">PASS</span>
lines below, followed by <span class="pass" style="font-family: monospace;">TEST COMPLETE</span>.
See <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=4059">Bugzilla Bug 4059</a>
Some values used with setAttribute() cause the attribute to be removed (null strings vs. empty strings).
</p>
<div id="console"></div>
<input id="textInput" startval="" style="">
<script>
var elem = document.getElementById("textInput");
shouldBe("elem.value", "''");
debug("<br>Before calling setAttribute(\"startval\", elem.value):<br>");
shouldBe("elem.getAttribute('startval')", "''");
elem.setAttribute("startval", elem.value);
debug("<br>After calling setAttribute(\"startval\", elem.value):<br>");
shouldBe("elem.getAttribute('startval')", "''");
debug("<br>Before calling setAttribute(\"style\", elem.value):<br>");
shouldBe("elem.getAttribute('style')", "''");
elem.setAttribute("style", elem.value);
debug("<br>After calling setAttribute(\"style\", elem.value):<br>");
shouldBe("elem.getAttribute('style')", "''");
debug("");
var successfullyParsed = true;
</script>
<script src="../js/resources/js-test-post.js"></script>
<script>
elem.style.display = "none";
if (window.layoutTestController)
layoutTestController.notifyDone();
</script>
</body>
</html>