summaryrefslogtreecommitdiff
path: root/includes/js/dijit/_base/window.js
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dijit/_base/window.js
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dijit/_base/window.js')
-rw-r--r--includes/js/dijit/_base/window.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/includes/js/dijit/_base/window.js b/includes/js/dijit/_base/window.js
new file mode 100644
index 0000000..c1bbb54
--- /dev/null
+++ b/includes/js/dijit/_base/window.js
@@ -0,0 +1,47 @@
+if(!dojo._hasResource["dijit._base.window"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit._base.window"] = true;
+dojo.provide("dijit._base.window");
+
+dijit.getDocumentWindow = function(doc){
+ // summary
+ // Get window object associated with document doc
+
+ // With Safari, there is not way to retrieve the window from the document, so we must fix it.
+ if(dojo.isSafari && !doc._parentWindow){
+ /*
+ This is a Safari specific function that fix the reference to the parent
+ window from the document object.
+ TODO: #5711: should the use of document below reference dojo.doc instead
+ in case they're not the same?
+ */
+ var fix=function(win){
+ win.document._parentWindow=win;
+ for(var i=0; i<win.frames.length; i++){
+ fix(win.frames[i]);
+ }
+ }
+ fix(window.top);
+ }
+
+ //In some IE versions (at least 6.0), document.parentWindow does not return a
+ //reference to the real window object (maybe a copy), so we must fix it as well
+ //We use IE specific execScript to attach the real window reference to
+ //document._parentWindow for later use
+ //TODO: #5711: should the use of document below reference dojo.doc instead in case they're not the same?
+ if(dojo.isIE && window !== document.parentWindow && !doc._parentWindow){
+ /*
+ In IE 6, only the variable "window" can be used to connect events (others
+ may be only copies).
+ */
+ doc.parentWindow.execScript("document._parentWindow = window;", "Javascript");
+ //to prevent memory leak, unset it after use
+ //another possibility is to add an onUnload handler which seems overkill to me (liucougar)
+ var win = doc._parentWindow;
+ doc._parentWindow = null;
+ return win; // Window
+ }
+
+ return doc._parentWindow || doc.parentWindow || doc.defaultView; // Window
+}
+
+}