Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/html/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  test_bug556645.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/dom/html/test/test_bug556645.html


<html>
<head>
  <title>Test for Bug 556645 and Bug 1848196</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script>
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(async () => {
  const object = document.createElement("object");
  object.setAttribute("type""text/html");
  object.setAttribute("width""200");
  object.setAttribute("height""200");
  document.body.appendChild(object);
  const promiseLoadObject = new Promise(resolve => {
    object.addEventListener("load", resolve, {once: true});
  });
  object.setAttribute("data""object_bug556645.html");
  await promiseLoadObject;
  runTest(object);
  object.remove();

  const embed = document.createElement("embed");
  embed.setAttribute("type""text/html");
  embed.setAttribute("width""200");
  embed.setAttribute("height""200");
  document.body.appendChild(embed);
  const promiseLoadEmbed = new Promise(resolve => {
    embed.addEventListener("load", resolve, {once: true});
  });
  embed.setAttribute("src""object_bug556645.html");
  await promiseLoadEmbed;
  runTest(embed);
  embed.remove();

  SimpleTest.finish();
});

function runTest(aObjectOrEmbed)
{
  const desc = `<${aObjectOrEmbed.tagName.toLowerCase()}>`;
  const childDoc = aObjectOrEmbed.contentDocument || aObjectOrEmbed.getSVGDocument();
  const body = childDoc.body;
  is(document.activeElement, document.body, `${desc}: focus in parent before`);
  is(childDoc.activeElement, body, `${desc}: focus in child before`);

  const button = childDoc.querySelector("button");
  button.focus();
  childDoc.defaultView.focus();
  is(document.activeElement, aObjectOrEmbed, `${desc}: focus in parent after focus()`);
  is(childDoc.activeElement, button, `${desc}: focus in child after focus()`);

  button.blur();
  const pbutton = document.getElementById("pbutton");
  pbutton.focus();

  let canTabMoveFocusToRootElement = !SpecialPowers.getBoolPref("dom.disable_tab_focus_to_root_element");
  if (canTabMoveFocusToRootElement) {
    synthesizeKey("KEY_Tab");
    is(document.activeElement, aObjectOrEmbed, `${desc}: focus in parent after tab`);
    is(childDoc.activeElement, childDoc.documentElement, `${desc}: focus in child after tab`);
  }
  synthesizeKey("KEY_Tab");
  is(document.activeElement, aObjectOrEmbed, `${desc}: focus in parent after tab 2`);
  is(childDoc.activeElement, button, `${desc}: focus in child after tab 2`);
}

</script>

<button id="pbutton">Parent</button>

</body>
</html>

Messung V0.5
C=100 H=100 G=100

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.