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

Quelle  test_option_disabled.html   Sprache: HTML

 
 products/sources/formale Sprachen/C/Firefox/dom/html/test/forms/test_option_disabled.html


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

<head>
  <meta charset="utf-8">
  <title>Test for HTMLOptionElement disabled attribute and pseudo-class</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=759666">Mozilla Bug 759666</a>
<p id="display"></p>
<div id="content" style="display: none">
  
</div>
<pre id="test">
<script type="application/javascript">

/** Test for HTMLOptionElement disabled attribute and pseudo-class **/

var testCases = [
  // Static checks.
  { html"",
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    result: { attr: "", idl: true, pseudo: true } },
  { html"",
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    result: { attr: "", idl: true, pseudo: true } },
  { html"",
    result: { attr: "", idl: true, pseudo: true } },
  { html"",
    result: { attr: null, idl: false, pseudo: true } },
  { html"",
    result: { attr: null, idl: false, pseudo: true } },
  { html"",
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    result: { attr: "", idl: true, pseudo: true } },

  // Dynamic checks: changing disable value.
  { html"",
    modifier(c) { c.querySelector('option').disabled = true; },
    result: { attr: "", idl: true, pseudo: true } },
  { html"",
    modifier(c) { c.querySelector('option').disabled = false; },
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    modifier(c) { c.querySelector('optgroup').disabled = true; },
    result: { attr: null, idl: false, pseudo: true } },
  { html"",
    modifier(c) { c.querySelector('option').disabled = false; },
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    modifier(c) { c.querySelector('optgroup').disabled = false; },
    result: { attr: "", idl: true, pseudo: true } },
  { html"",
    modifier(c) { c.querySelector('option').disabled = false; },
    result: { attr: null, idl: false, pseudo: true } },
  { html"",
    modifier(c) { c.querySelector('optgroup').disabled = c.querySelector('option').disabled = false; },
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    modifier(c) { c.querySelector('optgroup').disabled = false; },
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    modifier(c) { c.querySelector('optgroup[disabled]').disabled = false; },
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    modifier(c) { c.querySelector('optgroup[disabled]').disabled = false; },
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    modifier(c) { c.querySelector('optgroup').disabled = false; },
    result: { attr: "", idl: true, pseudo: true } },
  { html"",
    modifier(c) { c.querySelector('option').disabled = false; },
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    modifier(c) { c.querySelector('option').disabled = c.querySelector('option').disabled = false; },
    result: { attr: null, idl: false, pseudo: false } },

  // Dynamic checks: moving option element.
  { html"",
    modifier(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
    result: { attr: null, idl: false, pseudo: false } },
  { html"",
    modifier(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
    result: { attr: "", idl: true, pseudo: true } },
  { html"",
    modifier(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
    result: { attr: null, idl: false, pseudo: true } },
  { html"",
    modifier(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
    result: { attr: null, idl: false, pseudo: false } },
];

var content = document.getElementById('content');

testCases.forEach(function(testCase) {
  var result = testCase.result;

  content.innerHTML = testCase.html;

  if (testCase.modifier !== undefined) {
    testCase.modifier(content);
  }

  var option = content.querySelector('option');
  is(option.getAttribute('disabled'), result.attr, "disabled content attribute value should be " + result.attr);
  is(option.disabled, result.idl, "disabled idl attribute value should be " + result.idl);
  is(option.matches(":disabled"), result.pseudo, ":disabled state should be " + result.pseudo);
  is(option.matches(":enabled"), !result.pseudo, ":enabled state should be " + !result.pseudo);

  content.innerHTML = "";
});

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

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

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