Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: dom/base/test/chrome/chrome.toml
<?xml version="1.0"?>
<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>