Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  test_forOf.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/dom/bindings/test/test_forOf.html


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=725907
-->

<head>
  <meta charset="utf-8">
  <title>Test for Bug 725907</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=725907">Mozilla Bug 725907</a>
<p id="display"></p>
<div id="content" style="display: none">

</div>
<div id="basket">
  <span id="egg0"></span>
  <span id="egg1"><span id="duckling1"></span></span>
  <span id="egg2"></span>
</div>
<pre id="test">
<script type="application/javascript">

/** Test for Bug 725907 **/


function runTestsForDocument(document, msgSuffix) {
    function is(a, b, msg) { SimpleTest.is(a, b, msg + msgSuffix); }

    var basket = document.getElementById("basket");
    var egg3 = document.createElement("span");
    egg3.id = "egg3";

    var log = "";
    for (let x of basket.childNodes) {
        if (x.nodeType != x.TEXT_NODE)
            log += x.id + ";";
    }
    is(log, "egg0;egg1;egg2;""'for (x of div.childNodes)' should iterate over child nodes");

    log = "";
    for (let x of basket.childNodes) {
        if (x.nodeType != x.TEXT_NODE) {
            log += x.id + ";";
            if (x.id == "egg1")
                basket.appendChild(egg3);
        }
    }
    is(log, "egg0;egg1;egg2;egg3;""'for (x of div.childNodes)' should see elements added during iteration");

    log = "";
    basket.appendChild(document.createTextNode("some text"));
    for (let x of basket.children)
        log += x.id + ";";
    is(log, "egg0;egg1;egg2;egg3;""'for (x of div.children)' should iterate over child elements");

    var count = 0;
    // eslint-disable-next-line no-unused-vars
    for (let x of document.getElementsByClassName("hazardous-materials"))
        count++;
    is(count, 0, "'for (x of emptyNodeList)' loop should run zero times");

    log = "";
    for (let x of document.querySelectorAll("span"))
        log += x.id + ";";
    is(log, "egg0;egg1;duckling1;egg2;egg3;""for-of loop should work with a querySelectorAll() NodeList");
}

/* All the tests run twice. First, in this document, so without any wrappers. */
runTestsForDocument(document, "");

/* And once using the document of an iframe, so working with cross-compartment wrappers. */
SimpleTest.waitForExplicitFinish();
function iframeLoaded(iframe) {
    runTestsForDocument(iframe.contentWindow.document, " (in iframe)");
    SimpleTest.finish();
}

</script>

<iframe src="forOf_iframe.html" onload="iframeLoaded(this)"></iframe>

</pre>
</body>
</html>

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

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






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge