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 17 kB image not shown  

Quelle  test_bug430351.html   Sprache: HTML

 
 products/sources/formale Sprachen/C/Firefox/dom/html/test/test_bug430351.html


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

<head>
  <title>Test for Bug 430351</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>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=430351">Mozilla Bug 430351</a>
<p id="display"></p>
<div id="content">
  <div id="parent"></div>
  <div id="editableParent" contenteditable="true"></div>
  <iframe id="frame"></iframe>
  <map name="map"><area></map>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for Bug 430351 **/

var focusableElements = [
    "-1\">",
    "0\">",
    "0\" disabled>",
    "1\">",
    "true\">",

    "#\">",
    "#\" tabindex=\"-1\">",
    "#\" tabindex=\"0\">",
    "#\" tabindex=\"0\" disabled>",
    "#\" tabindex=\"1\">",
    "#\" contenteditable=\"true\">",
    "#\" disabled>",

    "",
    "",
    "",
    "",
    "",

    "",
    "",
    "",
    "",
    "",

    "",
    "",
    "",
    "",
    "",

    "
-1\">
"
,
    "
0\">
"
,
    "
1\">
"
,
    "
true\">
"
,
    "
0\" disabled>
"
,

    "",
    "-1\">",
    "0\">",
    "0\" disabled>",
    "1\">",
    "",
    "true\">",

    "",

    "",
    "",
    "",
    "",
    "",
    "",
    "",

    "",
    "",
    "",
    "",
    "",
    "",

    "-1\">",
    "0\">",
    "0\" disabled>",
    "1\">",

    "",
    "-1\">",
    "0\">",
    "1\">",
    "true\">",

    "button\">",
    "button\" tabindex=\"-1\">",
    "button\" tabindex=\"0\">",
    "button\" tabindex=\"1\">",
    "button\" contenteditable=\"true\">",

    "checkbox\">",
    "checkbox\" tabindex=\"-1\">",
    "checkbox\" tabindex=\"0\">",
    "checkbox\" tabindex=\"1\">",
    "checkbox\" contenteditable=\"true\">",

    "image\">",
    "image\" tabindex=\"-1\">",
    "image\" tabindex=\"0\">",
    "image\" tabindex=\"1\">",
    "image\" contenteditable=\"true\">",

    "password\">",
    "password\" tabindex=\"-1\">",
    "password\" tabindex=\"0\">",
    "password\" tabindex=\"1\">",
    "password\" contenteditable=\"true\">",

    "radio\">",
    "radio\" tabindex=\"-1\">",
    "radio\" tabindex=\"0\">",
    "radio\" tabindex=\"1\">",
    "radio\" contenteditable=\"true\">",
    "radio\" checked>",
    "
radio\" name=\"foo\">"
,

    "reset\">",
    "reset\" tabindex=\"-1\">",
    "reset\" tabindex=\"0\">",
    "reset\" tabindex=\"1\">",
    "reset\" contenteditable=\"true\">",

    "submit\">",
    "submit\" tabindex=\"-1\">",
    "submit\" tabindex=\"0\">",
    "submit\" tabindex=\"1\">",
    "submit\" contenteditable=\"true\">",

    "text\">",
    "text\" tabindex=\"-1\">",
    "text\" tabindex=\"0\">",
    "text\" tabindex=\"1\">",
    "text\" contenteditable=\"true\">",

    "number\">",
    "number\" tabindex=\"-1\">",
    "number\" tabindex=\"0\">",
    "number\" tabindex=\"1\">",
    "number\" contenteditable=\"true\">",

    "-1\">",
    "0\">",
    "1\">",
    "true\">",

    "java:a\">",
    "java:a\" tabindex=\"-1\">",
    "java:a\" tabindex=\"0\">",
    "java:a\" tabindex=\"0\" disabled>",
    "java:a\" tabindex=\"1\">",
    "java:a\" disabled>",
    "java:a\" contenteditable=\"true\">",

    "",
    "",
    "",
    "",
    "",

    "",
    "",
    "",
    "",

    "",
    "",
    "",
    ""
];

var nonFocusableElements = [
    "",
    "",

    "",
    "",

    "",
    "",

    "",
    "",

    "
"
,
    "
"
,

    "",
    "",
    "true\">",

    "#map\">",
    "#map\" tabindex=\"-1\">",
    "#map\" tabindex=\"0\">",
    "#map\" tabindex=\"0\" disabled>",
    "#map\" tabindex=\"1\">",
    "#map\" disabled>",
    "#map\" contenteditable=\"true\">",

    "0\" disabled>",
    "",

    "button\" tabindex=\"0\" disabled>",
    "button\" disabled>",

    "checkbox\" tabindex=\"0\" disabled>",
    "checkbox\" disabled>",

    "file\" tabindex=\"0\" disabled>",
    "file\" disabled>",

    "hidden\">",
    "hidden\" tabindex=\"-1\">",
    "hidden\" tabindex=\"0\">",
    "hidden\" tabindex=\"0\" disabled>",
    "hidden\" tabindex=\"1\">",
    "hidden\" disabled>",
    "hidden\" contenteditable=\"true\">",

    "image\" tabindex=\"0\" disabled>",
    "image\" disabled>",

    "password\" tabindex=\"0\" disabled>",
    "password\" disabled>",

    "radio\" tabindex=\"0\" disabled>",
    "radio\" disabled>",

    "reset\" tabindex=\"0\" disabled>",
    "reset\" disabled>",

    "submit\" tabindex=\"0\" disabled>",
    "submit\" disabled>",

    "text\" tabindex=\"0\" disabled>",
    "text\" disabled>",

    "",

    "",
    "",

    "",
    "",

    "",
    ""
];

var focusableInContentEditable = [
    "",
    "",
    "",
    "",
    "",

    "",
    "",
    "",
    "",
    "",

    "",
    "",
    "",
    "",
    "",

    "
-1\">
"
,
    "
0\">
"
,
    "
1\">
"
,
    "
0\" disabled>
"
,

    "",
    "-1\">",
    "0\">",
    "0\" disabled>",
    "1\">",
    "",
    "true\">",

    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",

    "-1\">",
    "0\">",
    "0\" disabled>",
    "1\">",

    "",
    "-1\">",
    "0\">",
    "1\">",
    "true\">",

    "button\">",
    "button\" tabindex=\"-1\">",
    "button\" tabindex=\"0\">",
    "button\" tabindex=\"1\">",
    "button\" contenteditable=\"true\">",

    "file\">",
    "file\" tabindex=\"-1\">",
    "file\" tabindex=\"0\">",
    "file\" tabindex=\"1\">",
    "file\" contenteditable=\"true\">",

    "checkbox\">",
    "checkbox\" tabindex=\"-1\">",
    "checkbox\" tabindex=\"0\">",
    "checkbox\" tabindex=\"1\">",
    "checkbox\" contenteditable=\"true\">",

    "image\">",
    "image\" tabindex=\"-1\">",
    "image\" tabindex=\"0\">",
    "image\" tabindex=\"1\">",
    "image\" contenteditable=\"true\">",

    "password\">",
    "password\" tabindex=\"-1\">",
    "password\" tabindex=\"0\">",
    "password\" tabindex=\"1\">",
    "password\" contenteditable=\"true\">",

    "radio\">",
    "radio\" tabindex=\"-1\">",
    "radio\" tabindex=\"0\">",
    "radio\" tabindex=\"1\">",
    "radio\" contenteditable=\"true\">",
    "radio\" checked>",
    "
radio\" name=\"foo\">"
,

    "reset\">",
    "reset\" tabindex=\"-1\">",
    "reset\" tabindex=\"0\">",
    "reset\" tabindex=\"1\">",
    "reset\" contenteditable=\"true\">",

    "submit\">",
    "submit\" tabindex=\"-1\">",
    "submit\" tabindex=\"0\">",
    "submit\" tabindex=\"1\">",
    "submit\" contenteditable=\"true\">",

    "text\">",
    "text\" tabindex=\"-1\">",
    "text\" tabindex=\"0\">",
    "text\" tabindex=\"1\">",
    "text\" contenteditable=\"true\">",

    "number\">",
    "number\" tabindex=\"-1\">",
    "number\" tabindex=\"0\">",
    "number\" tabindex=\"1\">",
    "number\" contenteditable=\"true\">",

    "-1\">",
    "0\">",
    "1\">",

    // Disabled doesn't work for .
    "0\" disabled>",
    "",

    "",
    "",
    "",
    "",
    "",

    "",
    "",
    "",

    "",
    "",
    ""
];

var focusableInDesignMode = [
    "",
    "-1\">",
    "0\">",
    "0\" disabled>",
    "1\">",
    "",
    "true\">",

    "-1\">",
    "0\">",
    "0\" disabled>",
    "1\">",
];

// Can't currently test these, need a plugin.
var focusableElementsTODO = [
    "java:a\">",
    "java:a\" tabindex=\"-1\">",
    "java:a\" tabindex=\"0\">",
    "java:a\" tabindex=\"0\" disabled>",
    "java:a\" tabindex=\"1\">",
    "java:a\" disabled>",
    "java:a\" contenteditable=\"true\">",
];

var serializer = new XMLSerializer();

function testElements(parent, tags, shouldBeFocusable)
{
    var focusable, errorSuffix = "";
    if (parent.ownerDocument.designMode == "on") {
        focusable = focusableInDesignMode;
        errorSuffix = " in a document with designMode=on";
    }
    else if (parent.contentEditable == "true") {
        focusable = focusableInContentEditable;
    }

    for (var tag of tags) {
        parent.ownerDocument.body.focus();

        if (focusableElementsTODO.indexOf(tag) > -1) {
            todo_is(parent.ownerDocument.activeElement, parent.firstChild,
                    tag + " should be focusable" + errorSuffix);
            continue;
        }

        parent.innerHTML = tag;

        // Focus the deepest descendant.
        var descendant = parent;
        while ((descendant = descendant.firstChild))
            element = descendant;

        if (element.nodeName == "IFRAME")
            var foo = element.contentDocument;

        element.focus();

        var errorPrefix = serializer.serializeToString(element) + " in " +
                          serializer.serializeToString(parent);

        try {
          // Make sure activeElement doesn't point to a
          // native anonymous element.
          parent.ownerDocument.activeElement.localName;
        } catch (ex) {
          ok(false, ex + errorPrefix + errorSuffix);
        }
        if (focusable ? focusable.indexOf(tag) > -1 : shouldBeFocusable) {
            is(parent.ownerDocument.activeElement, element,
               errorPrefix + " should be focusable" + errorSuffix);
        }
        else {
            isnot(parent.ownerDocument.activeElement, element,
                  errorPrefix + " should not be focusable" + errorSuffix);
        }

        parent.innerHTML = "";
    }
}

function test()
{
    var parent = document.getElementById("parent");
    var editableParent = document.getElementById("editableParent");

    testElements(parent, focusableElements, true);
    testElements(parent, nonFocusableElements, false);

    testElements(editableParent, focusableElements, true);
    testElements(editableParent, nonFocusableElements, false);

    var frame = document.getElementById("frame");
    frame.contentDocument.body.innerHTML = document.getElementById("content").innerHTML;
    frame.contentDocument.designMode = "on";
    parent = frame.contentDocument.getElementById("parent");
    editableParent = frame.contentDocument.getElementById("editableParent");

    testElements(parent, focusableElements, false);
    testElements(parent, nonFocusableElements, false);

    testElements(editableParent, focusableElements, false);
    testElements(editableParent, nonFocusableElements, false);
}

SimpleTest.waitForExplicitFinish();
addLoadEvent(test);
addLoadEvent(SimpleTest.finish);

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

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

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