Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / xpath / ambiguous-operators.html
blob60f49265cbc8f81d4354a2e587e0b83e57361244
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script src="xpath-test-pre.js"></script>
5 <style>
6 #context {display:none}
7 </style>
8 </head>
9 <body>
10 <p>Test that an NCName and * are interpreted as an operator when in
11 binary operator context, and as a NameTest otherwise.
13 <p>See <a href="http://bugs.webkit.org/show_bug.cgi?id=50366">bug 50366</a>:
14 XPath lexer misinterprets expression starting with "div".</p>
16 <div id="console"></div>
18 <div id="context">
19 <div id="two" div="x">2</div>
20 </div>
22 <script>
23 var context = document.getElementById('context');
24 var div = document.getElementById('two');
26 // =========== div ===========
28 test(document, context, "div", [div], null); // div with no preceding token
29 test(document, context, " div", [div], null);
30 // div following every possible [28] ExprToken http://www.w3.org/TR/xpath/
31 test(document, context, "(div) div (div)", 2/2, null); // div after ( and )
32 test(document, context, "self::node()[div] div 1", 2/1, null); // div after [ and ]
33 test(document, context, ". div .", 2/2, null); // div after .
34 test(document, div, ".. div ..", 2/2, null); // div after ..
35 test(document, context, "string(div/@div)", "x", null); // div after @
36 test(document, context, "substring-before('1992', div)", "199", null); // div after ,
37 test(document, div, "self::div", [div], null); // div after ::
38 test(document, context, "* div 4", 2/4, null); // div after NameTest *
39 test(document, context, "'3' div 4", 3/4, null); // div after Literal
40 test(document, context, "\"3\" div 4", 3/4, null); // div after Literal
41 test(document, context, "12 div 4", 12/4, null); // div after Number
43 // div following every [32] Operator
44 test(document, context, "true() and div", true, null); // div after OperatorName and
45 test(document, context, "false() or div", true, null); // div after OperatorName or
46 test(document, context, "div mod div", 0, null); // div after OperatorName mod
47 test(document, context, "div div div", 1, null); // div after OperatorName div
48 test(document, context, "3 * div", 6, null); // div after MultiplyOperator
49 test(document, context, "div/div", [], null); // div after /
50 test(document, context, "div//div", [], null); // div after //
51 test(document, context, "zz|div", [div], null); // div after |
52 test(document, context, "div+div", 4, null); // div after +
53 test(document, context, "- - div", 2, null); // div after unary -
54 test(document, context, "5 -div", 3, null); // div after binary -
55 test(document, context, "div=div", true, null); // div after =
56 test(document, context, "div!=div", false, null); // div after =
57 test(document, context, "div<div", false, null); // div after <
58 test(document, context, "div<=div", true, null); // div after <=
59 test(document, context, "div>div", false, null); // div after >
60 test(document, context, "div>=div", true, null); // div after >=
63 // =========== * ===========
65 test(document, context, "*", [div], null); // * with no preceding token
66 test(document, context, " *", [div], null);
67 // * following every possible [28] ExprToken http://www.w3.org/TR/xpath/
68 test(document, context, "(*) * (*)", 2*2, null); // * after ( and )
69 test(document, context, "self::node()[*] * 1", 2*1, null); // * after [ and ]
70 test(document, context, ". * .", 2*2, null); // * after .
71 test(document, div, ".. * ..", 2*2, null); // * after ..
72 // (* can't follow @)
73 test(document, context, "substring-before('1992', *)", "199", null); // * after ,
74 test(document, div, "self::*", [div], null); // * after ::
75 test(document, context, "* * 4", 2*4, null); // * after NameTest *
76 test(document, context, "'3' * 4", 3*4, null); // * after Literal
77 test(document, context, "\"3\" * 4", 3*4, null); // * after Literal
78 test(document, context, "12 * 4", 12*4, null); // * after Number
80 // * following every [32] Operator
81 test(document, context, "true() and *", true, null); // * after OperatorName and
82 test(document, context, "false() or *", true, null); // * after OperatorName or
83 test(document, context, "* mod *", 0, null); // * after OperatorName mod
84 test(document, context, "* div *", 1, null); // * after OperatorName div
85 test(document, context, "3 * *", 6, null); // * after MultiplyOperator
86 test(document, context, "*/*", [], null); // * after /
87 test(document, context, "*//*", [], null); // * after //
88 test(document, context, "zz|*", [div], null); // * after |
89 test(document, context, "*+*", 4, null); // * after +
90 test(document, context, "- - *", 2, null); // * after unary -
91 test(document, context, "5 -*", 3, null); // * after binary -
92 test(document, context, "*=*", true, null); // * after =
93 test(document, context, "*!=*", false, null); // * after =
94 test(document, context, "*<*", false, null); // * after <
95 test(document, context, "*<=*", true, null); // * after <=
96 test(document, context, "*>*", false, null); // * after >
97 test(document, context, "*>=*", true, null); // * after >=
99 var xmlDoc = (new DOMParser).parseFromString("<or xmlns='uri'>5</or>", "text/xml");
100 var nsResolver = function(prefix) {return 'uri';}
101 // div and * after :
102 test(xmlDoc, xmlDoc, "or:or", [xmlDoc.documentElement], nsResolver);
103 test(xmlDoc, xmlDoc, "or:*", [xmlDoc.documentElement], nsResolver);
105 // A few tests with mod as well
106 var xmlDoc2 = (new DOMParser).parseFromString("<mod and='x'>8</mod>", "text/xml");
107 test(xmlDoc2, xmlDoc2, "mod", [xmlDoc2.documentElement], null);
108 test(xmlDoc2, xmlDoc2, "mod mod mod", 0, null);
109 test(xmlDoc2, xmlDoc2, "(mod) mod 5", 3, null);
110 test(xmlDoc2, xmlDoc2, "string(mod/@and)", 'x', null);
111 </script>
112 </body>
113 </html>