summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/dom/elements-sections.js
blob: bbad85e5132db3b913df140126ad9f57433dfa59 (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
62
63
64
var sectionElements = {
  body: {
    // Obsolete
    text: {type: "string", treatNullAsEmptyString: true},
    link: {type: "string", treatNullAsEmptyString: true},
    vLink: {type: "string", treatNullAsEmptyString: true},
    aLink: {type: "string", treatNullAsEmptyString: true},
    bgColor: {type: "string", treatNullAsEmptyString: true},
    background: "string",
  },
  article: {},
  section: {},
  nav: {},
  aside: {},
  h1: {
    // Obsolete
    align: "string",
  },
  h2: {
    // Obsolete
    align: "string",
  },
  h3: {
    // Obsolete
    align: "string",
  },
  h4: {
    // Obsolete
    align: "string",
  },
  h5: {
    // Obsolete
    align: "string",
  },
  h6: {
    // Obsolete
    align: "string",
  },
  hgroup: {},
  header: {},
  footer: {},
  address: {},
};

mergeElements(sectionElements);

extraTests.push(function() {
  ReflectionTests.reflects({type: "enum", keywords: ["ltr", "rtl", "auto"]}, "dir", document, "dir", document.documentElement);
  // TODO: these behave differently if the body element is a frameset.  Also
  // should probably test with multiple bodies.
  ReflectionTests.reflects({type: "string", treatNullAsEmptyString: true}, "fgColor", document, "text", document.body);
  ReflectionTests.reflects({type: "string", treatNullAsEmptyString: true}, "linkColor", document, "link", document.body);
  ReflectionTests.reflects({type: "string", treatNullAsEmptyString: true}, "vlinkColor", document, "vlink", document.body);
  ReflectionTests.reflects({type: "string", treatNullAsEmptyString: true}, "alinkColor", document, "alink", document.body);
  ReflectionTests.reflects({type: "string", treatNullAsEmptyString: true}, "bgColor", document, "bgcolor", document.body);
  // Edge remains RTL if we don't do this, despite removing the attribute
  document.dir = "ltr";
  // Don't mess up the colors :)
  document.documentElement.removeAttribute("dir");
  var attrs = ["text", "bgcolor", "link", "alink", "vlink"];
  for (var i = 0; i < attrs.length; i++) {
    document.body.removeAttribute(attrs[i]);
  }
});