| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 | <title>Focus Issue Child</title> |
| 6 | <script> |
| 7 | // open the parent, if user tries to open the child directly |
| 8 | if (parent == window) |
| 9 | location.href = './focus-framedojo.html'; |
| 10 | </script> |
| 11 | <script type="text/javascript" src="../../dojo/dojo.js" |
| 12 | data-dojo-config="isDebug:true"></script> |
| 13 | <script type="text/javascript"> |
| 14 | dojo.require("dijit.focus"); |
| 15 | dojo.require("doh.runner"); |
| 16 | |
| 17 | // set objects in parent |
| 18 | for (var v in {'dijit':true, 'dojo':true, 'dojox':true}) |
| 19 | parent[v] = window[v]; |
| 20 | |
| 21 | // This will execute before the dojo.ready() code in dijit.focus() executes |
| 22 | dojo.setContext(parent, parent.document); |
| 23 | |
| 24 | dojo.ready(function(){ |
| 25 | doh.register("focus", function focus(){ |
| 26 | var d = new doh.Deferred(); |
| 27 | doh.is("input", dojo.byId("input").id, "found input"); |
| 28 | |
| 29 | dijit.focus.watch("curNode", function(attr, oldVal, newVal){ |
| 30 | console.log("focused on ", newVal); |
| 31 | if(!newVal){ |
| 32 | return; // IE gives spurious event |
| 33 | } |
| 34 | d.getTestCallback(function(){ |
| 35 | doh.is("input", newVal.id, "notified that focused on input"); |
| 36 | })(); |
| 37 | }); |
| 38 | |
| 39 | dojo.byId("input").focus(); |
| 40 | |
| 41 | return d; |
| 42 | }); |
| 43 | |
| 44 | doh.run(); |
| 45 | }); |
| 46 | </script> |
| 47 | </head> |
| 48 | <body bgcolor="#e0e0e0"> |
| 49 | this frame is for loading script only |
| 50 | </body> |
| 51 | </html> |