Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
if(!dojo._hasResource["dijit._base.window"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2
dojo._hasResource["dijit._base.window"] = true;
3
dojo.provide("dijit._base.window");
4
 
5
dijit.getDocumentWindow = function(doc){
6
	//	summary
7
	// 	Get window object associated with document doc
8
 
9
	// With Safari, there is not way to retrieve the window from the document, so we must fix it.
10
	if(dojo.isSafari && !doc._parentWindow){
11
		/*
12
			This is a Safari specific function that fix the reference to the parent
13
			window from the document object.
14
		*/
15
		var fix=function(win){
16
			win.document._parentWindow=win;
17
			for(var i=0; i<win.frames.length; i++){
18
				fix(win.frames[i]);
19
			}
20
		}
21
		fix(window.top);
22
	}
23
 
24
	//In some IE versions (at least 6.0), document.parentWindow does not return a
25
	//reference to the real window object (maybe a copy), so we must fix it as well
26
	//We use IE specific execScript to attach the real window reference to
27
	//document._parentWindow for later use
28
	if(dojo.isIE && window !== document.parentWindow && !doc._parentWindow){
29
		/*
30
		In IE 6, only the variable "window" can be used to connect events (others
31
		may be only copies).
32
		*/
33
		doc.parentWindow.execScript("document._parentWindow = window;", "Javascript");
34
		//to prevent memory leak, unset it after use
35
		//another possibility is to add an onUnload handler which seems overkill to me (liucougar)
36
		var win = doc._parentWindow;
37
		doc._parentWindow = null;
38
		return win;	//	Window
39
	}
40
 
41
	return doc._parentWindow || doc.parentWindow || doc.defaultView;	//	Window
42
}
43
 
44
}