tor-browser

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

fn-normalize-space.html (929B)


      1 <!DOCTYPE html>
      2 <link rel="help" href="https://www.w3.org/TR/1999/REC-xpath-19991116/#function-normalize-space">
      3 <link rel="help" href="https://www.w3.org/TR/xpath-functions-31/#func-normalize-space">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <body>
      7 <div id="target"> a <br> b</div>
      8 <script>
      9 function normalizeSpace(exp) {
     10  return document.evaluate(`normalize-space("${exp}")`, document).stringValue;
     11 }
     12 
     13 test(() => {
     14  assert_equals(document.evaluate('normalize-space()', document.querySelector('#target')).stringValue, 'a b');
     15 }, 'normalize-space() without arguments');
     16 
     17 test(() => {
     18  assert_equals(normalizeSpace(' a \t  b\r\nc '), 'a b c');
     19 
     20  assert_equals(normalizeSpace('y\x0B\x0C\x0E\x0Fz'), 'y\x0b\x0c\x0e\x0fz');
     21  assert_equals(normalizeSpace('\xA0 \u3000'), '\xA0 \u3000');
     22 }, 'normalize-space() should handle only #x20, #x9, #xD, and #xA');
     23 </script>