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>testing Core _docScroll function</title> |
---|
6 | <script type="text/javascript" src="../../dojo.js" data-dojo-config="isDebug:true"></script> |
---|
7 | <script type="text/javascript"> |
---|
8 | require(["dojo", "doh", "dojo/domReady!"], function(dojo, doh){ |
---|
9 | |
---|
10 | doh.register("t", |
---|
11 | [ |
---|
12 | function testNonScrolled(t){ |
---|
13 | dojo.global.scrollTo(0,0); |
---|
14 | var s = dojo._docScroll(); |
---|
15 | t.is(0, s.x); |
---|
16 | t.is(0, s.y); |
---|
17 | }, |
---|
18 | function testScrolled(t){ |
---|
19 | dojo.global.scrollTo(1,2); |
---|
20 | var s = dojo._docScroll(); |
---|
21 | t.is(1, s.x); |
---|
22 | t.is(2, s.y); |
---|
23 | }, |
---|
24 | function testQuirksNonScrolled(t){ |
---|
25 | var win = dojo.byId('iframe').iframeContentWindow; |
---|
26 | win.scrollTo(0,0); |
---|
27 | var s = dojo.withGlobal(win, "_docScroll", dojo); |
---|
28 | t.is(0, s.x); |
---|
29 | t.is(0, s.y); |
---|
30 | var s = dojo._docScroll(); |
---|
31 | t.is(1, s.x); |
---|
32 | t.is(2, s.y); |
---|
33 | }, |
---|
34 | function testQuirksScrolled(t){ |
---|
35 | dojo.global.scrollTo(0,0); |
---|
36 | var win = dojo.byId('iframe').iframeContentWindow; |
---|
37 | win.scrollTo(10,20); |
---|
38 | var s = dojo.withGlobal(win, "_docScroll", dojo); |
---|
39 | t.is(10, s.x); |
---|
40 | t.is(20, s.y); |
---|
41 | } |
---|
42 | ] |
---|
43 | ); |
---|
44 | doh.runOnLoad(); |
---|
45 | }); |
---|
46 | </script> |
---|
47 | </head> |
---|
48 | <body> |
---|
49 | <h1>testing Core _docScroll function</h1> |
---|
50 | <div id='div' style="border:0px;padding:0px;margin:0px;"> |
---|
51 | <iframe id="iframe" src="javascript:'<html><head><script>frameElement.iframeContentWindow=window</script></head><body><div style=\'height:500px;width:500px;\'> </div></body>'"></iframe> |
---|
52 | </div> |
---|
53 | <script type="text/javascript"> |
---|
54 | // make sure div is too big to display |
---|
55 | require(["dojo"], function(dojo) { |
---|
56 | var div = dojo.byId('div'); |
---|
57 | div.style.height = (dojo.doc.documentElement.clientHeight + 2) + "px"; |
---|
58 | div.style.width = (dojo.doc.documentElement.clientWidth + 1) + "px"; |
---|
59 | }); |
---|
60 | </script> |
---|
61 | </body> |
---|
62 | </html> |
---|
63 | |
---|