|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
|
4 |
|
5 <window title="Focus Switch Binding Test" |
|
6 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
7 |
|
8 <script type="application/javascript" |
|
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
|
10 |
|
11 <script> |
|
12 SimpleTest.waitForExplicitFinish(); |
|
13 |
|
14 function switchBinding() |
|
15 { |
|
16 $("box").style.MozBinding = "url(#second)"; |
|
17 } |
|
18 </script> |
|
19 |
|
20 <xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl" |
|
21 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
22 <xbl:binding id="first"> |
|
23 <xbl:content> |
|
24 <xul:button label="First"/> |
|
25 </xbl:content> |
|
26 <xbl:implementation> |
|
27 <xbl:constructor> |
|
28 document.getAnonymousNodes(this)[0].focus(); |
|
29 setTimeout(switchBinding, 0); |
|
30 </xbl:constructor> |
|
31 </xbl:implementation> |
|
32 </xbl:binding> |
|
33 <xbl:binding id="second"> |
|
34 <xbl:content> |
|
35 <xul:button label="Second"/> |
|
36 </xbl:content> |
|
37 <xbl:implementation> |
|
38 <xbl:constructor> |
|
39 $("after").focus(); |
|
40 </xbl:constructor> |
|
41 </xbl:implementation> |
|
42 </xbl:binding> |
|
43 </xbl:bindings> |
|
44 |
|
45 <box id="box" style="-moz-binding: url(#first)"/> |
|
46 <button id="after" label="After" onfocus="is(document.activeElement, $('after'), 'focus set'); SimpleTest.finish()"/> |
|
47 |
|
48 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
49 <p id="display"> |
|
50 </p> |
|
51 <div id="content" style="display: none"> |
|
52 </div> |
|
53 <pre id="test"> |
|
54 </pre> |
|
55 </body> |
|
56 |
|
57 </window> |