summaryrefslogtreecommitdiffstats
path: root/layout/style/test/test_non_content_accessible_properties.html
blob: 7a6e0f5d4ff55a8f63cc76aff12eefde5547dece (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="sheet"></style>
<div></div>
<script>
const NON_CONTENT_ACCESSIBLE_PROPERTIES = [
  "-x-span",
  "-x-lang",
  "-x-text-zoom",
  "-moz-list-reversed",
  "-moz-window-shadow",
  "-moz-window-opacity",
  "-moz-window-transform",
  "-moz-window-transform-origin",
  "-moz-top-layer",
  "-moz-script-size-multiplier",
  "-moz-script-level",
  "-moz-math-display",
  "-moz-math-variant",
  "-moz-script-min-size",
  "-moz-font-smoothing-background-color",
  "-moz-min-font-size-ratio",
  "-moz-script-size-multiplier",
  "-moz-default-appearance",
  "-moz-inert",
  // TODO(emilio): Whenever we stop using `-moz-binding` in a gazillion tests
  // we should add it here.
];

const sheet = document.getElementById("sheet");
const div = document.querySelector("div");

test(function() {
  sheet.textContent = `div { color: initial }`;
  assert_equals(sheet.sheet.cssRules[0].style.length, 1);
}, "sanity");

for (const prop of NON_CONTENT_ACCESSIBLE_PROPERTIES) {
  test(function() {
    sheet.textContent = `div { ${prop}: initial }`;
    let block = sheet.sheet.cssRules[0].style;
    assert_equals(
      block.length,
      0,
      prop + " shouldn't be parsed in content"
    );
    block.setProperty(prop, "initial");
    assert_equals(
      block.length,
      0,
      prop + " shouldn't be settable via CSSOM in content"
    );
    assert_equals(
      getComputedStyle(div).getPropertyValue(prop),
      "",
      prop + " shouldn't be accessible via CSSOM in content"
    );
  }, prop);
}
</script>