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

Quelle  test_urlSearchParams_sorting.html   Sprache: unbekannt

 

<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>Test for URLSearchParams.sort()</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript">

function compareArray(a, b) {
  is(a.length, b.length, "Length matches");
  for (let i = 0; i < a.length; ++i) {
    is(a[i], b[i], "Values " + i + " match");
  }
}

[
  {
    "input""z=b&a=b&z=a&a=a",
    "output": [["a""b"], ["a""a"], ["z""b"], ["z""a"]],
  },
  {
    "input""\uFFFD=x&\uFFFC&\uFFFD=a",
    "output": [["\uFFFC"""], ["\uFFFD""x"], ["\uFFFD""a"]],
  },
  {
    "input""ffi&🌈", // �� > code point, but < code unit because two code units
    "output": [["🌈"""], ["ffi"""]],
  },
  {
    "input""é&e\uFFFD&e\u0301",
    "output": [["e\u0301"""], ["e\uFFFD"""], ["é"""]],
  },
  {
    "input""z=z&a=a&z=y&a=b&z=x&a=c&z=w&a=d&z=v&a=e&z=u&a=f&z=t&a=g",
    "output": [["a""a"], ["a""b"], ["a""c"], ["a""d"], ["a""e"], ["a""f"], ["a""g"], ["z""z"], ["z""y"], ["z""x"], ["z""w"], ["z""v"], ["z""u"], ["z""t"]],
  },
].forEach((val) => {
  info("Run test: " + JSON.stringify(val) + "\n");

  let params = new URLSearchParams(val.input);
  params.sort();

  let i = 0;
  for (let param of params) {
    compareArray(param, val.output[i++]);
  }

  let url = new URL("?" + val.input"https://example/");
  url.searchParams.sort();
  params = new URLSearchParams(url.search);
  i = 0;
  for (let param of params) {
    compareArray(param, val.output[i++]);
  }
});

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

Messung V0.5
C=98 H=93 G=95

[ zur Elbe Produktseite wechseln0.14Quellennavigators  Analyse erneut starten  ]