function checkIMEStatus(element, isEnabled, description) {
// eslint-disable-next-line mozilla/use-documentGlobal
let elementWindow = element.ownerDocument.defaultView;
let expected = isEnabled
? SpecialPowers.Ci.nsIDOMWindowUtils.IME_STATUS_ENABLED
: SpecialPowers.Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED;
let got = SpecialPowers.wrap(elementWindow).windowUtils.IMEStatus;
is(got, expected, `IME should be ${isEnabled ? "enabled" : "disabled"} when ${description} has focus`);
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(async () => {
let iframe = document.getElementById("iframe");
let iframeDoc = iframe.contentDocument;
// import test elements into iframe
let imported = iframeDoc.importNode(document.getElementById("container"), true);
iframeDoc.body.append(imported);
for (let iframeKind of ["none", "focused", "unfocused"]) {
let doc = iframeKind === "none" ? document : iframeDoc;
for (let designMode of ["on", "off"]) {
doc.designMode = designMode;
for (let element of doc.querySelectorAll("[data-ime-enabled]")) {
element.focus();
let imeEnabled = element.dataset.imeEnabled;
let expect = {
inDesignMode: designMode === "on",
always: true,
never: false,
}[imeEnabled];
isnot(expect, undefined, `Invalid test (data-ime-enabled=${imeEnabled} should be one of always, never, inDesignMode)`);
doc.defaultView.getSelection().collapse(element);
if (iframeKind === "unfocused") {
// IME should always be disabled if iframe is not focused
expect = false; iframe.blur();
} else if (iframeKind === "focused") { iframe.focus();
}
let description = element.dataset.description + " element";
if (designMode === "on") {
description += " in design mode";
}
if (iframeKind !== "none") {
description += ` in ${iframeKind} iframe`;
}
checkIMEStatus(element, expect, description);
element.blur();
}
}
}
SimpleTest.finish();
});
</script>
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-09-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.