Changeset 10151

Show
Ignore:
Timestamp:
08/12/07 20:44:07 (16 months ago)
Author:
alex
Message:

some size-related changes and a bit of crusty function removal. Refs #3961

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/_loader/hostenv_browser.js

    r10088 r10151  
    218218        })(); 
    219219 
    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  
    234220        dojo._initFired = false; 
    235221        //      BEGIN DOMContentLoaded, from Dean Edwards (http://dean.edwards.name/weblog/2006/06/again/) 
     
    268254        } 
    269255 
    270         //      for Internet Explorer. readyState will not be achieved on init call, 
    271         //      but dojo doesn't need it however, we'll include it because we don't 
    272         //      know if there are other functions added that might.  Note that this has 
    273         //      changed because the build process strips all comments -- including 
    274         //      conditional ones. 
    275         if(dojo.isIE){ 
    276                 document.write('<scr'+'ipt defer src="//:" ' 
    277                         + 'onreadystatechange="if(this.readyState==\'complete\'){dojo._loadInit();}">' 
    278                         + '</scr'+'ipt>' 
    279                 ); 
    280         } 
    281  
    282256        if(/(WebKit|khtml)/i.test(navigator.userAgent)){ // sniff 
    283257                dojo._khtmlTimer = setInterval(function(){ 
     
    289263        //      END DOMContentLoaded 
    290264 
    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        })(); 
    307314 
    308315        /* 
     
    317324        }); 
    318325        */ 
    319  
    320         if(dojo.isIE){ 
    321                 try{ 
    322                         document.namespaces.add("v","urn:schemas-microsoft-com:vml"); 
    323                         document.createStyleSheet().addRule("v\\:*", "behavior:url(#default#VML)"); 
    324                 }catch(e){} 
    325         } 
    326326 
    327327        // stub, over-ridden by debugging code. This will at least keep us from 
     
    359359 
    360360        dojo._fireCallback = function(callback, context, cbArguments){ 
     361                // FIXME: should migrate to using "dojo.isString"! 
    361362                if((context)&&((typeof callback == "string")||(callback instanceof String))){ 
    362363                        callback = context[callback];