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

Quelle  test_nac_mutations.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/toolkit/content/tests/widgets/test_nac_mutations.html


<!DOCTYPE HTML>
<title>UA Widget mutation observer test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<video controls id="video"></video>
<div style="overflow: scroll; width: 100px; height: 100px" id="scroller"></div>
<script>
const video = document.getElementById("video");
const scroller = document.getElementById("scroller");

async function test_mutations_internal(observedNode, elementToMutate, expectMutations) {
  let resolveMutations;
  let mutations = new Promise(r => {
    resolveMutations = r;
  });

  let observer = new MutationObserver(function(m) {
    ok(expectMutations, "Mutations should be expected");
    resolveMutations(m)
  });

  SpecialPowers.wrap(observer).observe(observedNode, {
    subtree: true,
    attributes: true,
    chromeOnlyNodes: expectMutations,
  });

  elementToMutate.setAttribute("unlikely", `value-${expectMutations}`);

  if (expectMutations) {
    await mutations;
  } else {
    await new Promise(r => SimpleTest.executeSoon(r));
  }

  observer.disconnect();
}

async function test_mutations(observedNode, elementToMutate) {
  for (let chromeOnlyNodes of [true, false]) {
    info(`Testing chromeOnlyNodes: ${chromeOnlyNodes}`);
    await test_mutations_internal(observedNode, elementToMutate, chromeOnlyNodes);
  }
}

add_task(async function test_ua_mutations() {
  let shadow = SpecialPowers.wrap(video).openOrClosedShadowRoot;
  ok(!!shadow, "UA Widget ShadowRoot exists");

  await test_mutations(shadow, shadow.querySelector("*"));
});

add_task(async function test_scrollbar_mutations_same_anon_tree() {
  let scrollbar = SpecialPowers.wrap(window).InspectorUtils.getChildrenForNode(scroller, true, false)[0];
  is(scrollbar.tagName, "scrollbar""should find a scrollbar");
  await test_mutations(scrollbar, scrollbar);
});

add_task(async function test_scrollbar_mutations_same_tree() {
  let scrollbar = SpecialPowers.wrap(window).InspectorUtils.getChildrenForNode(scroller, true, false)[0];
  is(scrollbar.tagName, "scrollbar""should find a scrollbar");
  await test_mutations(scroller, scrollbar);
});
</script>

Messung V0.5
C=95 H=95 G=94

¤ Dauer der Verarbeitung: 0.13 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.