summaryrefslogtreecommitdiff
path: root/lib/dojo/io/iframe.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dojo/io/iframe.js')
-rw-r--r--lib/dojo/io/iframe.js70
1 files changed, 21 insertions, 49 deletions
diff --git a/lib/dojo/io/iframe.js b/lib/dojo/io/iframe.js
index 5b2af45a1..aa8ddf290 100644
--- a/lib/dojo/io/iframe.js
+++ b/lib/dojo/io/iframe.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,6 +9,8 @@ if(!dojo._hasResource["dojo.io.iframe"]){ //_hasResource checks added by build.
dojo._hasResource["dojo.io.iframe"] = true;
dojo.provide("dojo.io.iframe");
+dojo.getObject("io", true, dojo);
+
/*=====
dojo.declare("dojo.io.iframe.__ioArgs", dojo.__IoArgs, {
constructor: function(){
@@ -49,7 +51,7 @@ dojo.declare("dojo.io.iframe.__ioArgs", dojo.__IoArgs, {
=====*/
dojo.io.iframe = {
- // summary:
+ // summary:
// Sends an Ajax I/O call using and Iframe (for instance, to upload files)
create: function(/*String*/fname, /*String*/onloadstr, /*String?*/uri){
@@ -79,30 +81,12 @@ dojo.io.iframe = {
}
turi = (dojo.config["dojoBlankHtmlUrl"]||dojo.moduleUrl("dojo", "resources/blank.html"));
}
- var ifrstr = dojo.isIE ? '<iframe name="'+fname+'" src="'+turi+'" onload="'+onloadstr+'">' : 'iframe';
- cframe = dojo.doc.createElement(ifrstr);
- with(cframe){
- name = fname;
- setAttribute("name", fname);
- id = fname;
- }
- dojo.body().appendChild(cframe);
- window[fname] = cframe;
-
- with(cframe.style){
- if(!(dojo.isSafari < 3)){
- //We can't change the src in Safari 2.0.3 if absolute position. Bizarro.
- position = "absolute";
- }
- left = top = "1px";
- height = width = "1px";
- visibility = "hidden";
- }
+ var cframe = dojo.place(
+ '<iframe id="'+fname+'" name="'+fname+'" src="'+turi+'" onload="'+onloadstr+
+ '" style="position: absolute; left: 1px; top: 1px; height: 1px; width: 1px; visibility: hidden">',
+ dojo.body());
- if(!dojo.isIE){
- this.setSrc(cframe, turi, true);
- cframe.onload = new Function(onloadstr);
- }
+ window[fname] = cframe;
return cframe;
},
@@ -122,11 +106,8 @@ dojo.io.iframe = {
}else{
// Fun with DOM 0 incompatibilities!
var idoc;
- //WebKit > 521 corresponds with Safari 3, which started with 522 WebKit version.
- if(dojo.isIE || dojo.isWebKit > 521){
+ if(dojo.isIE || dojo.isWebKit){
idoc = iframe.contentWindow.document;
- }else if(dojo.isSafari){
- idoc = iframe.document;
}else{ // if(d.isMozilla){
idoc = iframe.contentWindow;
}
@@ -142,8 +123,8 @@ dojo.io.iframe = {
idoc.location.replace(src);
}
}
- }catch(e){
- console.log("dojo.io.iframe.setSrc: ", e);
+ }catch(e){
+ console.log("dojo.io.iframe.setSrc: ", e);
}
},
@@ -152,7 +133,7 @@ dojo.io.iframe = {
var doc = iframeNode.contentDocument || // W3
(
(
- (iframeNode.name) && (iframeNode.document) &&
+ (iframeNode.name) && (iframeNode.document) &&
(dojo.doc.getElementsByTagName("iframe")[iframeNode.name].contentWindow) &&
(dojo.doc.getElementsByTagName("iframe")[iframeNode.name].contentWindow.document)
)
@@ -165,7 +146,7 @@ dojo.io.iframe = {
},
send: function(/*dojo.io.iframe.__ioArgs*/args){
- //summary:
+ //summary:
// Function that sends the request to the server.
// This transport can only process one send() request at a time, so if send() is called
//multiple times, it will queue up the calls and only process one at a time.
@@ -195,8 +176,8 @@ dojo.io.iframe = {
if(handleAs != "html"){
if(handleAs == "xml"){
// FF, Saf 3+ and Opera all seem to be fine with ifd being xml. We have to
- // do it manually for IE. Refs #6334.
- if(dojo.isIE){
+ // do it manually for IE6-8. Refs #6334.
+ if(dojo.isIE < 9 || (dojo.isIE && dojo.isQuirks)){
dojo.query("a", dii._frame.contentWindow.document.documentElement).orphan();
var xmlText=(dii._frame.contentWindow.document).documentElement.innerText;
xmlText=xmlText.replace(/>\s+</g, "><");
@@ -218,7 +199,7 @@ dojo.io.iframe = {
}catch(e){
value = e;
}finally{
- ioArgs._callNext();
+ ioArgs._callNext();
}
return value;
},
@@ -238,7 +219,7 @@ dojo.io.iframe = {
dojo.io.iframe._currentDfd = null;
dojo.io.iframe._fireNextRequest();
}
- }
+ };
this._dfdQueue.push(dfd);
this._fireNextRequest();
@@ -297,16 +278,7 @@ dojo.io.iframe = {
// if we have things in content, we need to add them to the form
// before submission
var pHandler = function(name, value) {
- var tn;
- if(dojo.isIE){
- tn = dojo.doc.createElement("<input type='hidden' name='"+name+"'>");
- }else{
- tn = dojo.doc.createElement("input");
- tn.type = "hidden";
- tn.name = name;
- }
- tn.value = value;
- fn.appendChild(tn);
+ dojo.create("input", {type: "hidden", name: name, value: value}, fn);
ioArgs._contentToClean.push(name);
};
for(var x in content){
@@ -325,7 +297,7 @@ dojo.io.iframe = {
}
}
}
- //IE requires going through getAttributeNode instead of just getAttribute in some form cases,
+ //IE requires going through getAttributeNode instead of just getAttribute in some form cases,
//so use it for all. See #2844
var actnNode = fn.getAttributeNode("action");
var mthdNode = fn.getAttributeNode("method");
@@ -406,6 +378,6 @@ dojo.io.iframe = {
ioArgs._finished = true;
}
-}
+};
}