Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#10181 closed bug (invalid)

'name' is null or not an object

Reported by: [email protected] Owned by:
Priority: low Milestone: None
Component: deferred Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:

Description

The attached example works perfectly fine in Opera, Firefox, Chrome, IE9.

But in IE7 and IE8 it pops up a javascript error "'name' is null or not an object" somewhere in the jquery code. Tested with both 1.5.2 and 1.6.2 (and 'edge')

The example is supposed to populate two dropdown boxes using a (two-layer deep) associative array: the top layer is used to fill the first dropdown box, and when the user selects an item the second layer is used to fill the second dropdown box.

http://jsfiddle.net/da3nM/19/embedded/result/

Change History (11)

comment:1 Changed 10 years ago by anonymous

I forgot to mention that the error is triggered by a call at line 74:

var list = $.map(categories, function(cat) {
        return {
            name: cat.name,
            value: cat.id,
        };
    });

I cleaned up the javascript to make jsLint happy: http://jsfiddle.net/da3nM/20/

comment:2 Changed 10 years ago by Rick Waldron

Component: unfileddeferred
Priority: undecidedlow
Resolution: duplicate
Status: newclosed

This actually traces back to the try/finally in resolveWith

comment:3 Changed 10 years ago by Rick Waldron

Duplicate of #9033.

comment:4 Changed 10 years ago by anonymous

Note that when I insert a 'catch(pseudoError)' as mentioned in #9033, the "'name' is null or not an object" exception is indeed caught at that location, and IE8 does no longer show an error on page load.

But... the dropdowns are not populated, so it does not solve my issue :(

comment:5 Changed 10 years ago by S.V. Groeneveld <[email protected]…>

... which makes me think this is unrelated to #9033, since this is an actual (uncaught) exception, and not IE complaining about an invalid try/finally structure.

The main question is what exactly is causing the "'name' is null or not an object" error.

comment:6 Changed 10 years ago by Rick Waldron

If you bothered using code quality tools, you'd find that your data object is loaded with trailing commas, which will break in IE.

        { id: '8', name: 'Other' },
        { id: '9', name: 'Tackle Boxes' },
        { id: '20', name: 'Fishing Poles' },

http://jshint.org/

comment:7 Changed 10 years ago by Rick Waldron

Resolution: duplicate
Status: closedreopened

comment:8 Changed 10 years ago by Rick Waldron

Resolution: invalid
Status: reopenedclosed

comment:9 Changed 10 years ago by S.V. Groeneveld <[email protected]…>

I already ruled that out, as posted above: http://jsfiddle.net/da3nM/20/

JSLint says: "Your JS code is valid." JSHint.org says: "The code check passed"

comment:10 Changed 10 years ago by Rick Waldron

Last edited 10 years ago by Rick Waldron (previous) (diff)

comment:11 Changed 10 years ago by S.V. Groeneveld <[email protected]…>

Wow I don't understand how I could have missed that.

My apologies for the false report, and thanks for your patience.

Note: See TracTickets for help on using tickets.