Changeset 11393

Show
Ignore:
Timestamp:
11/04/07 23:49:04 (14 months ago)
Author:
alex
Message:

updating Safari version detection code to give us a real major version number. Using that update to ensure that we get/set iframe properties correctly in dojo.io.iframe. Fixes #5012

Location:
dojo/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/io/iframe.js

    r11254 r11393  
    33dojo.io.iframe = { 
    44        create: function(/*String*/fname, /*String*/onloadstr, /*String?*/uri){ 
    5                 //summary: Creates a hidden iframe in the page. Used mostly for IO transports. 
    6                 //              You do not need to call this to start a dojo.io.iframe request. Just call send(). 
    7                 //fname: String 
    8                 //              The name of the iframe. Used for the name attribute on the iframe. 
    9                 //onloadstr: String 
    10                 //              A string of JavaScript that will be executed when the content in the iframe loads. 
    11                 //uri: String 
    12                 //              The value of the src attribute on the iframe element. If a value is not 
    13                 //              given, then dojo/resources/blank.html will be used. 
     5                //      summary: 
     6                //              Creates a hidden iframe in the page. Used mostly for IO 
     7                //              transports.  You do not need to call this to start a 
     8                //              dojo.io.iframe request. Just call send(). 
     9                //      fname: String 
     10                //              The name of the iframe. Used for the name attribute on the 
     11                //              iframe. 
     12                //      onloadstr: String 
     13                //              A string of JavaScript that will be executed when the content 
     14                //              in the iframe loads. 
     15                //      uri: String 
     16                //              The value of the src attribute on the iframe element. If a 
     17                //              value is not given, then dojo/resources/blank.html will be 
     18                //              used. 
    1419                if(window[fname]){ return window[fname]; } 
    1520                if(window.frames[fname]){ return window.frames[fname]; } 
     
    3540         
    3641                with(cframe.style){ 
    37                         if(!dojo.isSafari){ 
     42                        // if(!dojo.isSafari){ 
    3843                                //We can't change the src in Safari 2.0.3 if absolute position. Bizarro. 
    3944                                position = "absolute"; 
    40                         } 
    41                         left = top = "0px"; 
    42                         height = width = "1px"; 
    43                         visibility = "hidden"; 
     45                        // } 
     46                        left = top = "300px"; 
     47                        height = width = "300px"; 
     48                        // visibility = "hidden"; 
    4449                } 
    4550 
     
    5459        setSrc: function(/*DOMNode*/iframe, /*String*/src, /*Boolean*/replace){ 
    5560                //summary: 
    56                 //              Sets the URL that is loaded in an IFrame. The replace parameter indicates whether 
    57                 //              location.replace() should be used when changing the location of the iframe. 
     61                //              Sets the URL that is loaded in an IFrame. The replace parameter 
     62                //              indicates whether location.replace() should be used when 
     63                //              changing the location of the iframe. 
    5864                try{ 
    5965                        if(!replace){ 
     
    6672                                // Fun with DOM 0 incompatibilities! 
    6773                                var idoc; 
    68                                 if(dojo.isIE){ 
     74                                if(dojo.isIE || dojo.isSafari > 2){ 
    6975                                        idoc = iframe.contentWindow.document; 
    7076                                }else if(dojo.isSafari){ 
     
    106112        dojo.io.iframe.__ioArgs = function(kwArgs){ 
    107113                //      summary: 
    108                 //              All the properties described in the dojo.__ioArgs type, apply to this 
    109                 //              type. The following additional properties are allowed for dojo.io.iframe.send(): 
     114                //              All the properties described in the dojo.__ioArgs type, apply 
     115                //              to this type. The following additional properties are allowed 
     116                //              for dojo.io.iframe.send(): 
    110117                //      method: String? 
    111                 //              The HTTP method to use. "GET" or "POST" are the only supported values. 
    112                 //              It will try to read the value from the form node's method, then try this 
    113                 //              argument. If neither one exists, then it defaults to POST. 
     118                //              The HTTP method to use. "GET" or "POST" are the only supported 
     119                //              values.  It will try to read the value from the form node's 
     120                //              method, then try this argument. If neither one exists, then it 
     121                //              defaults to POST. 
    114122                //      handleAs: String? 
    115                 //              Specifies what format the result data should be given to the load/handle callback. Valid values are: 
    116                 //              text, html, javascript, json. IMPORTANT: For all values EXCEPT html, 
    117                 //              The server response should be an HTML file with a textarea element. The response data should be inside the textarea 
    118                 //              element. Using an HTML document the only reliable, cross-browser way this transport can know 
    119                 //              when the response has loaded. For the html handleAs value, just return a normal HTML document. 
    120                 //              NOTE: xml or any other XML type is NOT supported by this transport. 
     123                //              Specifies what format the result data should be given to the 
     124                //              load/handle callback. Valid values are: text, html, javascript, 
     125                //              json. IMPORTANT: For all values EXCEPT html, The server 
     126                //              response should be an HTML file with a textarea element. The 
     127                //              response data should be inside the textarea element. Using an 
     128                //              HTML document the only reliable, cross-browser way this 
     129                //              transport can know when the response has loaded. For the html 
     130                //              handleAs value, just return a normal HTML document.  NOTE: xml 
     131                //              or any other XML type is NOT supported by this transport. 
    121132                //      content: Object? 
    122133                //              If "form" is one of the other args properties, then the content 
    123                 //              object properties become hidden form form elements. For instance, a content 
    124                 //              object of {name1 : "value1"} is converted to a hidden form element with a name 
    125                 //              of "name1" and a value of "value1". If there is not a "form" property, then 
    126                 //              the content object is converted into a name=value&name=value string, by 
     134                //              object properties become hidden form form elements. For 
     135                //              instance, a content object of {name1 : "value1"} is converted 
     136                //              to a hidden form element with a name of "name1" and a value of 
     137                //              "value1". If there is not a "form" property, then the content 
     138                //              object is converted into a name=value&name=value string, by 
    127139                //              using dojo.objectToQuery(). 
    128140        } 
     
    159171                                                value = ifd.getElementsByTagName("textarea")[0].value; //text 
    160172                                                if(handleAs == "json"){ 
    161                                                         value = dojo.fromJson("(" + value + ")"); //json 
     173                                                        value = dojo.fromJson(value); //json 
    162174                                                }else if(handleAs == "javascript"){ 
    163175                                                        value = dojo.eval(value); //javascript 
     
    308320                        for(var i = 0; i < toClean.length; i++) { 
    309321                                var key = toClean[i]; 
    310                                 if(dojo.isSafari){ 
     322                                if(dojo.isSafari < 3){ 
    311323                                        //In Safari (at least 2.0.3), can't use form[key] syntax to find the node, 
    312324                                        //for nodes that were dynamically added. 
  • dojo/trunk/_base/_loader/hostenv_browser.js

    r11363 r11393  
    4545                d.isOpera = (dua.indexOf("Opera") >= 0) ? tv : 0; 
    4646                d.isKhtml = (dav.indexOf("Konqueror") >= 0)||(dav.indexOf("Safari") >= 0) ? tv : 0; 
    47                 d.isSafari = (dav.indexOf("Safari") >= 0) ? tv : 0; 
     47                if(dav.indexOf("Safari") >= 0){ 
     48                        var vi = dav.indexOf("Version/"); 
     49                        d.isSafari = (vi) ? parseFloat(dav.substring(vi+8)) : 2; 
     50                } 
    4851                var geckoPos = dua.indexOf("Gecko"); 
    4952                d.isMozilla = d.isMoz = ((geckoPos >= 0)&&(!d.isKhtml)) ? tv : 0;