Skip to main content

Bug Tracker

Side navigation

#10181 closed bug (invalid)

Opened August 31, 2011 06:50PM UTC

Closed September 01, 2011 09:59PM UTC

Last modified September 01, 2011 11:10PM UTC

'name' is null or not an object

Reported by: s.v.groeneveld@gmail.com 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/

Attachments (0)
Change History (11)

Changed August 31, 2011 07:15PM UTC by anonymous comment:1

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/

Changed September 01, 2011 05:35PM UTC by rwaldron comment:2

component: unfileddeferred
priority: undecidedlow
resolution: → duplicate
status: newclosed

This actually traces back to the try/finally in resolveWith

Changed September 01, 2011 05:35PM UTC by rwaldron comment:3

Duplicate of #9033.

Changed September 01, 2011 08:25PM UTC by anonymous comment:4

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 :(

Changed September 01, 2011 09:55PM UTC by S.V. Groeneveld <s.v.groeneveld@gmail.com> comment:5

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

Changed September 01, 2011 09:59PM UTC by rwaldron comment:6

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/

Changed September 01, 2011 09:59PM UTC by rwaldron comment:7

resolution: duplicate
status: closedreopened

Changed September 01, 2011 09:59PM UTC by rwaldron comment:8

resolution: → invalid
status: reopenedclosed

Changed September 01, 2011 10:26PM UTC by S.V. Groeneveld <s.v.groeneveld@gmail.com> comment:9

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"

Changed September 01, 2011 10:43PM UTC by rwaldron comment:10

_comment0: Cool, now that there are no errors, it works marvelously. You're welcome. \ \ IE7 http://gyazo.com/dc5024ce7dc105857d32f11fef3a1588.png \ \ IE8 http://gyazo.com/6075bbbfed55747b7c4a08dffd92eec4.png1314917015380590

Changed September 01, 2011 11:10PM UTC by S.V. Groeneveld <s.v.groeneveld@gmail.com> comment:11

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

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