lexical-structure.html (1067B)
1 <!DOCTYPE html> 2 <link rel="help" href="https://www.w3.org/TR/1999/REC-xpath-19991116/#exprlex"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <body> 6 <script> 7 function parse(expression) { 8 document.evaluate(expression, document, null, XPathResult.ANY_TYPE, null); 9 } 10 11 // https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-Literal 12 test(() => { 13 parse(' \'a"bc\' '); 14 parse(' "a\'bc" '); 15 16 assert_throws_dom('SyntaxError', () => { parse(' \u2019xyz\u2019 '); }); 17 }, 'Literal: Only \' and " should be handled as literal quotes.'); 18 19 // https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-ExprWhitespace 20 test(() => { 21 parse(' \t\r\n.\r\n\t '); 22 23 assert_throws_dom('SyntaxError', () => { parse('\x0B\x0C .'); }); 24 assert_throws_dom('SyntaxError', () => { parse('\x0E\x0F .'); }); 25 assert_throws_dom('SyntaxError', () => { parse('\u3000 .'); }); 26 assert_throws_dom('SyntaxError', () => { parse('\u2029 .'); }); 27 }, 'ExprWhitespace: Only #x20 #x9 #xD or #xA must be handled as a whitespace.'); 28 </script> 29 </body>