$.each doesn't check for null
var something = ['one', 'two', 'three'];
// some more code
// then woops!
something = null;
$.each(something, function(){
console.log(this);
});
The code above will cause a js error on something.length.
to fix it you need do do the following... maybe this check should be incorporated?
var something = ['one', 'two', 'three'];
// some more code
// then woops!
something = null;
if (something != nul) {
$.each(something, function(){
console.log(this);
});
}
Change History (7)
Component: |
unfiled →
core
|
Milestone: |
None →
1.6.3
|
Owner: |
set to Rick Waldron
|
Priority: |
undecided →
low
|
Status: |
new →
assigned
|
Resolution: |
→ wontfix
|
Status: |
assigned →
closed
|
Resolution: |
wontfix
|
Status: |
closed →
reopened
|
Resolution: |
→ duplicate
|
Status: |
reopened →
closed
|
Thanks for reporting this, however jQuery cannot account for every possible arbitrary programming structure mistake. I recommend making a check for
null
before using $.each