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

Quelle  test_style_cssText.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/dom/base/test/test_style_cssText.html


<html>
<head>
<meta charset="UTF-8">
<title>Test for Bug 1391169</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style id="style"></style>
</head>
<body>
<pre id="log">
Log is:
</pre>
<script>
let styleElement = document.getElementById("style");
let logElement = document.getElementById("log");
console.log("logElement is " + logElement);

function log(text)
{
  logElement.innerHTML += text + "\n";
}

function textContentToCssText(text)
{
  // Pass input in via textContent.
  styleElement.textContent = text;

  // Read output from concatenated cssText of all rules.
  let s = "";
  let rules = document.styleSheets[1].cssRules;
  for (let i = 0; i < rules.length; ++i) {
    s += rules.item(i).cssText;
  }
  return s;
}

function noWhitespace(text)
{
  return text.replace(/\s/g, "");
}

function testData(input)
{
  let text;
  let pass1Goal;
  if (typeof(input) == "string") {
    // Only text data, assume characters should be the same.
    text = input;
    pass1Goal = input;
  } else {
    [text, pass1Goal] = input;
  }

  let pass1Text = textContentToCssText(text);
  is(noWhitespace(pass1Text), noWhitespace(pass1Goal), "textContent --> cssText correct characters emitted with input \"" + text + "\"");

  let pass2Text = textContentToCssText(pass1Text);
  is(pass2Text, pass1Text, "textContent --> cssText roundtrip with input \"" + text + "\"");

  log(text + " --> " + pass1Text + " --> " + pass2Text);
}

let data = [
  "*{}",
  "* *{}",
  "* > *{}",
  "*>*{}",
  "* * *{}",
  "* > * > *{}",
  "* + *{}",
  "* ~ *{}",
  ["*|*{}""*{}"],
  ["*|* > *{}""* > *{}"],
  "#tag{}",
  "tag{}",
  "@namespace tag url(\"fakeURL\"); tag|*{}",
  "@namespace tag url(\"fakeURL\"); tag|* + *{}",
];

for (let i = 0; i < data.length; i++) {
  testData(data[i]);
}
</script>
</body>
</html>

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

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