Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Bug 1676785"
<html:body>
<xul:hbox>
<html:input id="xul" />
</xul:hbox>
<html:div>
<html:input id="non-xul" />
</html:div>
</html:body>
<script class="testbody">
SimpleTest.waitForExplicitFinish();
function shouldPreserveHistory(input, preserve) {
input.focus();
input.value = "abc";
input.value = "def";
let ctrl = navigator.platform.indexOf("Mac") == 0 ? { metaKey: true } : { ctrlKey: true };
synthesizeKey("z", ctrl);
(preserve ? is : isnot)(input.value, "abc", `Expected ${input.id} to ${preserve ? "" : "not "}preserve undo history when setting .value`);
}
window.onload = function() {
shouldPreserveHistory(document.getElementById("xul"), true);
shouldPreserveHistory(document.getElementById("non-xul"), false);
SimpleTest.finish();
}
</script>
</window>