layout/inspector/tests/test_getCSSPseudoElementNames.html
author Emilio Cobos Álvarez <emilio@crisal.io>
Sun, 25 Mar 2018 17:31:55 +0200
changeset 417756 70754a946fde161c04f86df1b67e3913c8ec590a
parent 398730 441bc7969a24fe257162f7517e31bfe49c92bdd9
child 465908 b5c4a873d52ccbc8e7d063e608421ad80a3365e5
permissions -rw-r--r--
Bug 509958: Unprefix :-moz-selection. r=dbaron,xidorn Our implementation is totally not what the spec says, but totally what other UAs do, see https://github.com/w3c/csswg-drafts/issues/2474. So given this is causing webcompat pain, I think we should be pragmatic and just unprefix this. We could keep serialization and getComputedStyle with ::selection working with a bit more effort, like we do for :-moz-placeholder, but I'd prefer not doing at least the serialization bit, and just alias in nsCSSPseudoElements :-moz-selection to selection too. MozReview-Commit-ID: 6lxctozRDqv

<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>Test InspectorUtils::getCSSPseudoElementNames</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <script type="application/javascript">
  const InspectorUtils = SpecialPowers.InspectorUtils;

  let expected = new Set([
    ":after",
    ":before",
    ":backdrop",
    ":cue",
    ":first-letter",
    ":first-line",
    ":placeholder",
    ":selection",
    ":-moz-color-swatch",
    ":-moz-focus-inner",
    ":-moz-focus-outer",
    ":-moz-list-bullet",
    ":-moz-list-number",
    ":-moz-math-anonymous",
    ":-moz-meter-bar",
    ":-moz-placeholder",
    ":-moz-progress-bar",
    ":-moz-range-progress",
    ":-moz-range-thumb",
    ":-moz-range-track",
  ]);

  let names = InspectorUtils.getCSSPseudoElementNames();
  for (let name of names) {
    ok(expected.has(name), name + " is included");
    expected.delete(name);
  }

  if (expected.size > 0) {
    todo_is(expected.size, 0,
            "ideally all pseudo-element names would be listed in this test");
    for (let extra of expected) {
      info("extra element: " + extra);
    }
  }

  </script>
</head>
<body>
<h1>Test InspectorUtils::getCSSPseudoElementNames</h1>
<p id="display"></p>
<div id="content" style="display: none">

</div>
<pre id="test">
</pre>
</body>
</html>