2150 |
mathias |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
<title>dijit.focus Test</title>
|
|
|
6 |
<style type="text/css">
|
|
|
7 |
@import "../../../dojo/resources/dojo.css";
|
|
|
8 |
@import "../../themes/tundra/tundra.css";
|
|
|
9 |
@import "../css/dijitTests.css";
|
|
|
10 |
</style>
|
|
|
11 |
|
|
|
12 |
<script type="text/javascript" src="../../../dojo/dojo.js"
|
|
|
13 |
djConfig="isDebug: true"></script>
|
|
|
14 |
<script type="text/javascript">
|
|
|
15 |
dojo.require("dijit._base.focus");
|
|
|
16 |
var savedFocus;
|
|
|
17 |
dojo.addOnLoad(function(){
|
|
|
18 |
fakeWidget = { domNode: dojo.byId("save") };
|
|
|
19 |
dojo.subscribe("focusNode", function(node){ console.log("focused on " + (node?(node.id||node.tagName):"nothing"));});
|
|
|
20 |
});
|
|
|
21 |
function save(){
|
|
|
22 |
console.debug("save function");
|
|
|
23 |
savedFocus = dijit.getFocus(fakeWidget);
|
|
|
24 |
}
|
|
|
25 |
function restore(){
|
|
|
26 |
dijit.focus(savedFocus);
|
|
|
27 |
}
|
|
|
28 |
</script>
|
|
|
29 |
</head>
|
|
|
30 |
<body style="background-color: #fff; color: black; padding: 0; margin: 0" class="tundra">
|
|
|
31 |
|
|
|
32 |
<h3>Focus/Selection Save/Restore Test</h3>
|
|
|
33 |
<p>This is for testing whether focus and selection are restored by the focus manager</p>
|
|
|
34 |
<form style="border: 2px solid blue;">
|
|
|
35 |
<input id=input1 value=tom><br>
|
|
|
36 |
<input id=input2 value=jones><br>
|
|
|
37 |
<textarea id=textarea>hello there!</textarea><br>
|
|
|
38 |
<button id=button>push me</button>
|
|
|
39 |
</form>
|
|
|
40 |
|
|
|
41 |
<button id="save" onclick="save();">Save focus/selection state</button>
|
|
|
42 |
<button onclick="restore();">Restore focus/selection state</button>
|
|
|
43 |
|
|
|
44 |
</body>
|
|
|
45 |
</html>
|