Ticket #10181 (closed bug: invalid)
'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.
Change History
comment:2 Changed 22 months 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:4 Changed 22 months 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 22 months 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 22 months 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' },
comment:7 Changed 22 months ago by rwaldron
- Status changed from closed to reopened
- Resolution duplicate deleted
comment:8 Changed 22 months ago by rwaldron
- Status changed from reopened to closed
- Resolution set to invalid
comment:9 Changed 22 months 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 22 months ago by rwaldron
Cool, now that there are no errors, it works marvelously. You're welcome.
comment:11 Changed 22 months 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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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/