×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    9

    jQuery Selectors Crashing App

    Hi,

    The app I'm building has 3 categories. I run the same code for all 3, it crashes on 2 categories, but not on one of them.

    The line of code where it crashes (id and cat variables are properly being passed):
    Code:
    var $lis = $('#' + id + ' ul').children('.' + cat);
    In my dev environment, that selector should return 0 elements because the <ul> is actually empty (it won't be once the app is working properly), but regardless of that, I don't see why the app would crash.

    I've also tried different variants of that selector such as:
    Code:
    var $lis = $('#' + id + ' ul .' + cat);
    Code:
    var $lis = $('#' + id).find('.' + cat);
    but these last 2 just crash the app for all 3 categories instead of just 2.

  2. #2
    Regular Contributor
    Join Date
    Apr 2003
    Location
    Akron Ohio USA
    Posts
    229

    Re: jQuery Selectors Crashing App

    Does this code return an array of children elements of a given id element in the document or does this attempt to parse a style sheet by a given rule?

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    9

    Re: jQuery Selectors Crashing App

    It returns a jquery element, which is similar to an array of dom elements. Nothing to do with parsing css, it just uses css syntax to target elements.

  4. #4
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    60

    Re: jQuery Selectors Crashing App

    Quote Originally Posted by alexheyd View Post
    It returns a jquery element, which is similar to an array of dom elements. Nothing to do with parsing css, it just uses css syntax to target elements.
    Do you have a simple testcase of this? Preferably the bare minimum code and content that is required to get this to still crash? It would be very much appreciated! You can email it to me at ext-petrus.2.lundqvist(at)nokia.com

    Thanks!

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Posts
    115

    Re: jQuery Selectors Crashing App

    Hey,
    Which device are you using?
    jQuery incompatibility is (unfortunately) a known issue on some earlier S60 3rd FP2 device SW.


    ps

  6. #6
    Registered User
    Join Date
    Oct 2008
    Location
    Brighton, UK
    Posts
    20

    Re: jQuery Selectors Crashing App

    I'm having a similar problem (crashing) using jQuery 1.3 selectors on the N79:

    Using the horoscope example (from Getting Started... http://is.gd/gB0u), including jquery 1.3 and changing horoscope.js (line ~80) from:

    document.getElementById("mainView").style.display = "none";

    to:

    $("#mainView").hide("slow");

    Crashes when viewed on my N79. Works fine in the SDK emulator (3rd Ed FP 2), within Aptana and on the 5800 XpressMusic - so it's likely a version issue. Is there a way to determine which version of WRT a device supports?

    Update - if I omit "slow" (or any speed argument) and just use .hide() it does seem to work. Shame, being able to use nice, subtle little effects (reliably) with jQuery would add a lot to widgets.
    Last edited by bryanrieger; 2009-01-21 at 11:18. Reason: Added an update

  7. #7
    Registered User
    Join Date
    Dec 2008
    Posts
    1

    Re: jQuery Selectors Crashing App

    First of all the $ is a javascript object when you are using jquery.

    So if you just use

    Code:
    var lis = $('#' + id).find('.' + cat);
    another approach is to use a string passed to the jquery selector:

    from:
    Code:
    var $lis = $('#' + id + ' ul .' + cat);
    replace it with
    Code:
    var selector = '#' + id + ' ul .' + cat; // the selector is constructed first
    var lis = $(selector); // and than is passed to the jquery to obtain the desired info.
    Some while ago i had the same problem in desktop development and the approach above helped me.

Similar Threads

  1. Try to ODD app, get Symbian err -10509
    By glindberg in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2008-05-30, 05:58
  2. Changing App Mgr settings from J2ME app
    By ddbhasin in forum Mobile Java General
    Replies: 6
    Last Post: 2007-09-21, 07:18
  3. why my app is not shown in emulator?....due to i have change UID
    By bharats in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 2007-09-12, 06:49
  4. renaming app, how??
    By Audun Holme in forum Symbian
    Replies: 2
    Last Post: 2007-05-13, 12:10
  5. Dialog's clipping area (again). Nokia experts, please help
    By synov in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-06-26, 14:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×