Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

unable to trigger jquery-specific events

#71

After downloading envjs from github 9/11/09, I wrote the following small script, executed with java -jar lib/env-js.jar script.js

I expected to see the "this is not called" print statements, but instead saw only
" $ java -jar lib/env-js.jar twit.js INFO: [Fri Sep 11 2009 07:56:17 GMT-0500 (CDT)] {ENVJS} adding value to history: file:/C:/cygwin/home/jeff/workspace/twitJs/index.html INFO: [Fri Sep 11 2009 07:56:18 GMT-0500 (CDT)] {ENVJS} Sucessfully loaded document at file:/C:/cygwin/home/jeff/workspace/twitJs/index.html "

load('lib/env.rhino.js');

window.location = "index.html";

load('lib/jquery/jquery-1.3.2.js');

var requestURL = "http://twitter.com/statuses/user_timeline/femurchasm.json?callback=?";
$.getJSON(requestURL, function(json, status) {

print('this is not called');
$.each(json, function(i) {                                                                                    
    print(this['text']);                                                                                      
});

});

$(document).ready(function() {

print('this is not called either');

});

Reported by jhemminger · September 11th, 2009 @ 03:03 AM

State: resolved
Milestone: 1.1 Release
Assigned to: Thatcher Thatcher

Activity

  1. Thatcher
    Thatcher

    ah because envjs uses a synchronous loading process during window.location =
    '', your jquery ready function is not defined until after ready has been triggered. try one of these solutions (both should work, if not please post
    back to this ticket)

    1) set window.location at the end of your script, not the beginning

    2) manually trigger ready with jQuery.ready()

    Hope that helps

    Thatcher

    September 11th, 2009 @ 12:18 PM

  2. jhemminger
    jhemminger

    I modified my script:

    load('lib/env.rhino.js');

    load('lib/jquery/jquery-1.3.2.js');

    $(document).ready(function() {

    var requestURL = "http://twitter.com/statuses/user_timeline/femurchasm.json?callback=?";
    print('requestUrl: ' + requestURL);
    $.getJSON(requestURL, function(json, status) {
        print('here');
        $.each(json, function(i) {
            print(this['text']);
        });
    });
    

    });

    window.location = "index.html";

    and I receive the following output:

    $ java -jar lib/env-js.jar twit.js js: uncaught JavaScript runtime exception: TypeError: Cannot read property "compareDocumentPosition" from null

    js: uncaught JavaScript runtime exception: TypeError: Cannot find function ready in object [object Object].

    September 15th, 2009 @ 06:06 AM

  3. Thatcher
    Thatcher
    • State changed from new to open
    • Milestone set to 1.1 Release

    [responsible:id#36440 state:"open" milestone:id#49862 bulk edit command]

    October 28th, 2009 @ 01:23 PM

  4. Thatcher
    Thatcher

    I believe you may be using an early version of jquery 1.3.2 This error was seen with early versions and does not appear in the latest.

    October 29th, 2009 @ 04:28 PM

  5. Thatcher
    Thatcher
    • State changed from open to resolved

    pretty sure this is resolved so I'm going to close. feel free to ping us if it's still not working for you.

    November 11th, 2009 @ 04:28 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.