| 220 | | dojo._handleNodeEvent = function(/*DomNode*/node, /*String*/evtName, /*Function*/fp){ |
| 221 | | // summary: |
| 222 | | // non-destructively adds the specified function to the node's |
| 223 | | // evtName handler. |
| 224 | | // node: the DomNode to add the handler to |
| 225 | | // evtName: should be in the form "click" for "onclick" handlers |
| 226 | | var oldHandler = node["on"+evtName] || function(){}; |
| 227 | | node["on"+evtName] = function(){ |
| 228 | | fp.apply(node, arguments); |
| 229 | | oldHandler.apply(node, arguments); |
| 230 | | } |
| 231 | | return true; |
| 232 | | } |
| 233 | | |
| 291 | | if(dojo.isIE){ |
| 292 | | // IE WebControl hosted in an application can fire "beforeunload" and "unload" |
| 293 | | // events when control visibility changes, causing Dojo to unload too soon. The |
| 294 | | // following code fixes the problem |
| 295 | | // Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;199155 |
| 296 | | dojo._handleNodeEvent(window, "beforeunload", function(){ |
| 297 | | dojo._unloading = true; |
| 298 | | window.setTimeout(function(){ dojo._unloading = false; }, 0); |
| 299 | | }); |
| 300 | | dojo._handleNodeEvent(window, "unload", function(){ |
| 301 | | if(dojo._unloading){ dojo.unloaded(); } |
| 302 | | }); |
| 303 | | }else{ |
| 304 | | // FIXME: dojo.unloaded requires dojo scope |
| 305 | | dojo._handleNodeEvent(window, "beforeunload", function() { dojo.unloaded(); }); |
| 306 | | } |
| | 265 | (function(){ |
| | 266 | |
| | 267 | var _w = window; |
| | 268 | var _handleNodeEvent = function(/*String*/evtName, /*Function*/fp){ |
| | 269 | // summary: |
| | 270 | // non-destructively adds the specified function to the node's |
| | 271 | // evtName handler. |
| | 272 | // evtName: should be in the form "click" for "onclick" handlers |
| | 273 | var oldHandler = _w[evtName] || function(){}; |
| | 274 | _w[evtName] = function(){ |
| | 275 | fp.apply(_w, arguments); |
| | 276 | oldHandler.apply(_w, arguments); |
| | 277 | } |
| | 278 | } |
| | 279 | |
| | 280 | if(dojo.isIE){ |
| | 281 | // for Internet Explorer. readyState will not be achieved on init |
| | 282 | // call, but dojo doesn't need it however, we'll include it |
| | 283 | // because we don't know if there are other functions added that |
| | 284 | // might. Note that this has changed because the build process |
| | 285 | // strips all comments -- including conditional ones. |
| | 286 | |
| | 287 | document.write('<scr'+'ipt defer src="//:" ' |
| | 288 | + 'onreadystatechange="if(this.readyState==\'complete\'){dojo._loadInit();}">' |
| | 289 | + '</scr'+'ipt>' |
| | 290 | ); |
| | 291 | |
| | 292 | // IE WebControl hosted in an application can fire "beforeunload" and "unload" |
| | 293 | // events when control visibility changes, causing Dojo to unload too soon. The |
| | 294 | // following code fixes the problem |
| | 295 | // Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;199155 |
| | 296 | var _unloading = true; |
| | 297 | _handleNodeEvent("onbeforeunload", function(){ |
| | 298 | _w.setTimeout(function(){ _unloading = false; }, 0); |
| | 299 | }); |
| | 300 | _handleNodeEvent("onunload", function(){ |
| | 301 | if(_unloading){ dojo.unloaded(); } |
| | 302 | }); |
| | 303 | |
| | 304 | try{ |
| | 305 | document.namespaces.add("v","urn:schemas-microsoft-com:vml"); |
| | 306 | document.createStyleSheet().addRule("v\\:*", "behavior:url(#default#VML)"); |
| | 307 | }catch(e){} |
| | 308 | }else{ |
| | 309 | // FIXME: dojo.unloaded requires dojo scope |
| | 310 | _handleNodeEvent("beforeunload", dojo.unloaded); |
| | 311 | } |
| | 312 | |
| | 313 | })(); |