diff options
author | Andrew Dolgov <[email protected]> | 2013-03-18 10:26:24 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-03-18 10:26:26 +0400 |
commit | f0cfe83e3725f9a3928da97a6e3085e79cb25309 (patch) | |
tree | 4b0af188defaa807c7bc6ff3a101b41c9166c463 /lib/dijit/BackgroundIframe.js.uncompressed.js | |
parent | 9a2885da170ffd64358b99194095851a2d09c1b6 (diff) |
upgrade dojo to 1.8.3 (refs #570)
Diffstat (limited to 'lib/dijit/BackgroundIframe.js.uncompressed.js')
-rw-r--r-- | lib/dijit/BackgroundIframe.js.uncompressed.js | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/lib/dijit/BackgroundIframe.js.uncompressed.js b/lib/dijit/BackgroundIframe.js.uncompressed.js new file mode 100644 index 000000000..06ee17e06 --- /dev/null +++ b/lib/dijit/BackgroundIframe.js.uncompressed.js @@ -0,0 +1,110 @@ +define("dijit/BackgroundIframe", [ + "require", // require.toUrl + "./main", // to export dijit.BackgroundIframe + "dojo/_base/config", + "dojo/dom-construct", // domConstruct.create + "dojo/dom-style", // domStyle.set + "dojo/_base/lang", // lang.extend lang.hitch + "dojo/on", + "dojo/sniff", // has("ie"), has("mozilla"), has("quirks") + "dojo/_base/window" // win.doc.createElement +], function(require, dijit, config, domConstruct, domStyle, lang, on, has, win){ + + // module: + // dijit/BackgroundIFrame + + // TODO: remove _frames, it isn't being used much, since popups never release their + // iframes (see [22236]) + var _frames = new function(){ + // summary: + // cache of iframes + + var queue = []; + + this.pop = function(){ + var iframe; + if(queue.length){ + iframe = queue.pop(); + iframe.style.display=""; + }else{ + if(has("ie") < 9){ + var burl = config["dojoBlankHtmlUrl"] || require.toUrl("dojo/resources/blank.html") || "javascript:\"\""; + var html="<iframe src='" + burl + "' role='presentation'" + + " style='position: absolute; left: 0px; top: 0px;" + + "z-index: -1; filter:Alpha(Opacity=\"0\");'>"; + iframe = win.doc.createElement(html); + }else{ + iframe = domConstruct.create("iframe"); + iframe.src = 'javascript:""'; + iframe.className = "dijitBackgroundIframe"; + iframe.setAttribute("role", "presentation"); + domStyle.set(iframe, "opacity", 0.1); + } + iframe.tabIndex = -1; // Magic to prevent iframe from getting focus on tab keypress - as style didn't work. + } + return iframe; + }; + + this.push = function(iframe){ + iframe.style.display="none"; + queue.push(iframe); + } + }(); + + + dijit.BackgroundIframe = function(/*DomNode*/ node){ + // summary: + // For IE/FF z-index schenanigans. id attribute is required. + // + // description: + // new dijit.BackgroundIframe(node). + // + // Makes a background iframe as a child of node, that fills + // area (and position) of node + + if(!node.id){ throw new Error("no id"); } + if(has("ie") || has("mozilla")){ + var iframe = (this.iframe = _frames.pop()); + node.appendChild(iframe); + if(has("ie")<7 || has("quirks")){ + this.resize(node); + this._conn = on(node, 'resize', lang.hitch(this, function(){ + this.resize(node); + })); + }else{ + domStyle.set(iframe, { + width: '100%', + height: '100%' + }); + } + } + }; + + lang.extend(dijit.BackgroundIframe, { + resize: function(node){ + // summary: + // Resize the iframe so it's the same size as node. + // Needed on IE6 and IE/quirks because height:100% doesn't work right. + if(this.iframe){ + domStyle.set(this.iframe, { + width: node.offsetWidth + 'px', + height: node.offsetHeight + 'px' + }); + } + }, + destroy: function(){ + // summary: + // destroy the iframe + if(this._conn){ + this._conn.remove(); + this._conn = null; + } + if(this.iframe){ + _frames.push(this.iframe); + delete this.iframe; + } + } + }); + + return dijit.BackgroundIframe; +}); |