summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/selectors/pseudo-classes/dir.html
blob: 8edd9b8ab2b19569e4ea20f66cc9d7b1b32f0c27 (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
<!DOCTYPE html>
<html id=html>
  <head id=head>
    <meta charset=utf-8 id=meta>
    <title id=title>Selector: pseudo-classes (:dir(ltr), :dir(rtl))</title>
    <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
    <link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
    <script src="/resources/testharness.js" id=script1></script>
    <script src="/resources/testharnessreport.js" id=script2></script>
    <script src="utils.js" id=script3></script>
    <style id=style>
      #span1 {direction: rtl;}
      #span5, #span6 {display: none;}
    </style>
  </head>
  <body id=body>
    <div id="log"></div>
    <bdo dir="rtl" id=bdo1>WERBEH</bdo>
    <bdo dir="ltr" id=bdo2>HEBREW</bdo>
    <bdi id=bdi1>HEBREW</bdi>
    <bdi dir="rtl" id=bdi2>WERBEH</bdi>
    <bdi dir="ltr" id=bdi3>HEBREW</bdi>
    <bdi id=bdi4>إيان</bdi>
    <span id=span1>WERBEH</span>
    <span dir="rtl" id=span2>WERBEH</span>
    <span dir="ltr" id=span3>HEBREW</span>
    &#x202E;<span id=span4>WERBEH</span>&#x202C;
    <span dir="rtl" id=span5>WERBEH</span>
    <span dir="ltr" id=span6>HEBREW</span>
    <bdo dir="auto" id=bdo3>HEBREW</bdo>
    <bdo dir="auto" id=bdo4>إيان</bdo>
    <bdo dir="ltr" id=bdo5>עברית</bdo>

    <script id=script4>
      testSelectorIdsMatch(":dir(rtl)", ["bdo1", "bdi2", "bdi4", "span2", "span5", "bdo4"], "':dir(rtl)' matches all elements whose directionality is 'rtl'.");

      var ltrElements = ["html", "head", "meta", "title", "link1", "link2", "script1", "script2", "script3", "style", "body", "log", "bdo2", "bdi1", "bdi3", "span1", "span3", "span4", "span6", "bdo3", "bdo5", "script4"];

      testSelectorIdsMatch(":dir(ltr)", ltrElements, "':dir(ltr)' matches all elements whose directionality is 'ltr'.");

      var bdo = document.createElement("bdo");
      bdo.setAttribute("dir", "ltr");
      testSelectorIdsMatch(":dir(ltr)", ltrElements, "':dir(ltr)' doesn't match elements not in the document.");
    </script>
  </body>
</html>