jQuery: The Write Less, Do More JavaScript Library

Ticket #2819: fixed-load.diff

File fixed-load.diff, 1.5 kB (added by flesler, 3 months ago)

Changes on ajax.js and the test that would fail w/o this change.

  • src/ajax.js

     
    11jQuery.fn.extend({ 
     2    // Keep a copy of the old load 
     3    _load: jQuery.fn.load, 
     4     
    25    load: function( url, params, callback ) { 
    3         if ( jQuery.isFunction( url ) ) 
    4             return this.bind("load", url); 
     6        if ( typeof url != 'string' ) 
     7            return this._load( url ); 
    58 
    69        var off = url.indexOf(" "); 
    710        if ( off >= 0 ) { 
  • test/unit/event.js

     
    112112    ok( $("a.test:first").triggerHandler("click") === false, "Handler is bound to appendTo'd elements" ); 
    113113}); 
    114114 
    115 test("click()", function() { 
    116     expect(5); 
     115test("trigger() shortcuts", function() { 
     116    expect(6); 
    117117    $('<li><a href="#">Change location</a></li>').prependTo('#firstUL').find('a').bind('click', function() { 
    118118        var close = $('spanx', this); // same with $(this).find('span'); 
    119119        equals( close.length, 0, "Context element does not exist, length must be zero" ); 
     
    138138    }; 
    139139    $('#simon1').click(); 
    140140    equals( clickCounter, 1, "Check that click, triggers onclick event handler on an a tag also" ); 
     141     
     142    //try triggering load with $().load() used to fail 
     143    $('<img />').load(function(){ 
     144        ok( true, "Trigger the load event, using the shortcut .load(), used to fail."); 
     145    }).load(); 
    141146}); 
    142147 
    143148test("unbind(event)", function() {