tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

dir-pseudo-on-bdi-element.html (2464B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
      5 <link rel="help" href="https://html.spec.whatwg.org/multipage/dom.html#the-directionality">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 </head>
      9 <body>
     10 <script>
     11 
     12 test(() => {
     13    const bdi = document.createElement('bdi');
     14    assert_true(bdi.matches(':dir(ltr)'));
     15    assert_false(bdi.matches(':dir(rtl)'));
     16 
     17    bdi.textContent = '\u05EA';
     18    assert_false(bdi.matches(':dir(ltr)'));
     19    assert_true(bdi.matches(':dir(rtl)'));
     20 }, 'bdi element without dir content attribute');
     21 
     22 test(() => {
     23    const bdi = document.createElement('bdi');
     24    bdi.setAttribute('dir', 'foo');
     25    assert_true(bdi.matches(':dir(ltr)'));
     26    assert_false(bdi.matches(':dir(rtl)'));
     27 
     28    bdi.textContent = '\u05EA';
     29    assert_false(bdi.matches(':dir(ltr)'));
     30    assert_true(bdi.matches(':dir(rtl)'));
     31 }, 'bdi element with invalid dir content attribute');
     32 
     33 test(() => {
     34    const bdi = document.createElement('bdi');
     35    bdi.setAttribute('dir', 'auto');
     36    assert_true(bdi.matches(':dir(ltr)'));
     37    assert_false(bdi.matches(':dir(rtl)'));
     38 
     39    bdi.textContent = '\u05EA';
     40    assert_false(bdi.matches(':dir(ltr)'));
     41    assert_true(bdi.matches(':dir(rtl)'));
     42 
     43    bdi.setAttribute('dir', 'AUTO');
     44    assert_false(bdi.matches(':dir(ltr)'));
     45    assert_true(bdi.matches(':dir(rtl)'));
     46 }, 'bdi element with dir=auto content attribute');
     47 
     48 test(() => {
     49    const bdi = document.createElement('bdi');
     50    bdi.setAttribute('dir', 'ltr');
     51    assert_true(bdi.matches(':dir(ltr)'));
     52    assert_false(bdi.matches(':dir(rtl)'));
     53 
     54    bdi.setAttribute('dir', 'LTR');
     55    assert_true(bdi.matches(':dir(ltr)'));
     56    assert_false(bdi.matches(':dir(rtl)'));
     57 
     58    bdi.textContent = '\u05EA';
     59    assert_true(bdi.matches(':dir(ltr)'));
     60    assert_false(bdi.matches(':dir(rtl)'));
     61 }, 'bdi element with dir=ltr content attribute');
     62 
     63 test(() => {
     64    const bdi = document.createElement('bdi');
     65    bdi.setAttribute('dir', 'rtl');
     66    assert_false(bdi.matches(':dir(ltr)'));
     67    assert_true(bdi.matches(':dir(rtl)'));
     68 
     69    bdi.setAttribute('dir', 'RTL');
     70    assert_false(bdi.matches(':dir(ltr)'));
     71    assert_true(bdi.matches(':dir(rtl)'));
     72 
     73    bdi.textContent = '\u05EA';
     74    assert_false(bdi.matches(':dir(ltr)'));
     75    assert_true(bdi.matches(':dir(rtl)'));
     76 }, 'bdi element with dir=rtl content attribute');
     77 
     78 </script>
     79 </body>
     80 </html>