Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<?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 and bug 2069367"
<html:body>
<xul:hbox>
<html:input id="xul-parent" />
</xul:hbox>
<html:div>
<html:input id="plain" />
<html:input id="with-attribute" preserveundohistory="" />
</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-parent"), false);
shouldPreserveHistory(document.getElementById("plain"), false);
shouldPreserveHistory(document.getElementById("with-attribute"), true);
SimpleTest.finish();
}
</script>
</window>