50 lines
1.7 KiB
HTML
50 lines
1.7 KiB
HTML
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
<script>
|
|
if (window.testRunner)
|
|
testRunner.waitUntilDone();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<p id="description">
|
|
This test checks that an attribute is not removed when set to the initial value of an <input> 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="https://bugs.webkit.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("");
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
<script>
|
|
elem.style.display = "none";
|
|
if (window.testRunner)
|
|
testRunner.notifyDone();
|
|
</script>
|
|
</body>
|
|
</html>
|