916f6aae6548c514465cc3265a7e9de015e10989
[WebKit.git] / LayoutTests / fast / dom / SelectorAPI / not-supported-namespace-in-selector.html
1 <html>
2 <head>
3 <script>
4     if (window.layoutTestController)
5         layoutTestController.dumpAsText();
6
7     log = function(msg)
8     {
9         document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
10     }
11
12     shouldThrow = function(_a)
13     {
14         try {
15             eval(_a);
16             log("FAIL: " + _a + " did not throw");
17         } catch(ex) {
18             log("PASS: " + _a + " throws: " + ex);
19         }
20     }
21
22     shouldNotThrow = function(_a)
23     {
24         try {
25             eval(_a);
26             log("PASS: " + _a + " did not throw");
27         } catch(ex) {
28             log("FAIL: " + _a + " throws: " + ex);
29         }
30     }
31
32     onload = function()
33     {
34         shouldThrow("document.querySelector('bbb|pre')");
35         shouldThrow("document.querySelectorAll('bbb|pre')");
36         shouldNotThrow("document.querySelector('*|pre')");
37         shouldNotThrow("document.querySelectorAll('*|pre')");
38         shouldNotThrow("document.querySelector('|pre')");
39         shouldNotThrow("document.querySelectorAll('|pre')");
40
41         shouldThrow("document.querySelector('div bbb|pre')");
42         shouldThrow("document.querySelectorAll('div bbb|pre')");
43         shouldNotThrow("document.querySelector('div *|pre')");
44         shouldNotThrow("document.querySelectorAll('div *|pre')");
45         shouldNotThrow("document.querySelector('div |pre')");
46         shouldNotThrow("document.querySelectorAll('div |pre')");
47
48         shouldThrow("document.querySelector('[bbb|name=value]')");
49         shouldThrow("document.querySelectorAll('[bbb|name=value]')");
50         shouldNotThrow("document.querySelector('[*|name=value]')");
51         shouldNotThrow("document.querySelectorAll('[*|name=value]')");
52         shouldNotThrow("document.querySelector('[|name=value]')");
53         shouldNotThrow("document.querySelectorAll('[|name=value]')");
54
55         shouldThrow("document.querySelector('div [bbb|name=value]')");
56         shouldThrow("document.querySelectorAll('div [bbb|name=value]')");
57         shouldNotThrow("document.querySelector('div [*|name=value]')");
58         shouldNotThrow("document.querySelectorAll('div [*|name=value]')");
59         shouldNotThrow("document.querySelector('div [|name=value]')");
60         shouldNotThrow("document.querySelectorAll('div [|name=value]')");
61     }
62 </script>
63 </head>
64 <body>
65     <p>This tests that we throw a NAMESPACE_ERR when parsing a selector string for querySelector and querySelectorAll
66         that contains a namespace.</p>
67     <pre id="console" name="value"></pre>
68 </body>
69 </html>