#71 ✓resolved
jhemminger

unable to trigger jquery-specific events

Reported by jhemminger | September 11th, 2009 @ 03:03 AM | in 1.1 Release

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');

});

Comments and changes to this ticket

  • Thatcher

    Thatcher September 11th, 2009 @ 12:18 PM

    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

  • jhemminger

    jhemminger September 15th, 2009 @ 06:06 AM

    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].

  • Thatcher

    Thatcher October 28th, 2009 @ 01:23 PM

    • State changed from “new” to “open”
    • Milestone set to 1.1 Release

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

  • Thatcher

    Thatcher October 29th, 2009 @ 04:28 PM

    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.

  • Thatcher

    Thatcher November 11th, 2009 @ 04:28 PM

    • 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.

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

a javascript browser environment

People watching this ticket

Tags

Pages