Bug Tracker

Changeset 4123

Show
Ignore:
Timestamp:
12/12/07 20:54:44 (1 year ago)
Author:
davidserduke
Message:

Fixed #1750 by adding a url that starts with "//" and is a dataType "script" will now use a cross domain load the same as urls that start with "http".

Location:
trunk/jquery
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/ajax.js

    r4106 r4123  
    220220        // If we're requesting a remote document 
    221221        // and trying to load JSON or Script with a GET 
    222         if ( !s.url.indexOf("http") && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) { 
     222        if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) { 
    223223            var head = document.getElementsByTagName("head")[0]; 
    224224            var script = document.createElement("script"); 
  • trunk/jquery/test/unit/ajax.js

    r4106 r4123  
    373373    expect(2); 
    374374    stop(); 
     375    window.foobar = null; 
    375376    $.getScript(url("data/test.js"), function() { 
    376377        equals( foobar, "bar", 'Check if script was evaluated' ); 
     
    564565    stop(); 
    565566 
     567    window.foobar = null; 
    566568    $.ajax({ 
    567569        url: base + "data/test.js", 
     
    581583    stop(); 
    582584 
     585    window.foobar = null; 
    583586    $.ajax({ 
    584587        url: base + "data/test.js", 
     
    588591            ok( foobar, "Script results returned (GET, no callback)" ); 
    589592            equals( status, "success", "Script results returned (GET, no callback)" ); 
     593            start(); 
     594        } 
     595    }); 
     596}); 
     597 
     598test("$.ajax() - script, Remote with scheme-less URL", function() { 
     599    expect(2); 
     600 
     601    var base = window.location.href.replace(/\?.*$/, ""); 
     602    base = base.replace(/^.*?\/\//, "//"); 
     603 
     604    stop(); 
     605 
     606    window.foobar = null; 
     607    $.ajax({ 
     608        url: base + "data/test.js", 
     609        dataType: "script", 
     610        success: function(data){ 
     611            ok( foobar, "Script results returned (GET, no callback)" ); 
    590612            start(); 
    591613        }