Bug Tracker

Ticket #10181 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

'name' is null or not an object

Reported by: s.v.groeneveld@… Owned by:
Priority: low Milestone: None
Component: deferred Version: 1.6.2
Keywords: Cc:
Blocking: Blocked by:

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

comment:1 Changed 3 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 3 years ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to duplicate
  • Status changed from new to closed
  • Component changed from unfiled to deferred

This actually traces back to the try/finally in resolveWith

comment:3 Changed 3 years ago by rwaldron

Duplicate of #9033.

comment:4 Changed 3 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 3 years ago by S.V. Groeneveld <s.v.groeneveld@…>

... 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 3 years ago by rwaldron

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 3 years ago by rwaldron

  • Status changed from closed to reopened
  • Resolution duplicate deleted

comment:8 Changed 3 years ago by rwaldron

  • Status changed from reopened to closed
  • Resolution set to invalid

comment:9 Changed 3 years ago by S.V. Groeneveld <s.v.groeneveld@…>

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 3 years ago by rwaldron

Last edited 3 years ago by rwaldron (previous) (diff)

comment:11 Changed 3 years ago by S.V. Groeneveld <s.v.groeneveld@…>

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.