Side navigation
#8008 closed bug (invalid)
Opened January 19, 2011 09:32AM UTC
Closed January 19, 2011 05:18PM UTC
function each launch an error when the object is empty on verion 1.4.4
Reported by: | sirio3mil@gmail.com | Owned by: | sirio3mil@gmail.com |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | misc | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The expression $.each(data, function(key, value) {}); launch an error in case of data is empty or null:
On Google Chrome 10 the error is: function length can´t be applied to a null value
On Mozilla Firefox 3.6.13 the error es: (jquery minified) variable j is null; (standard jquery) variable object is null
I think it not happend on jquery 1.4 cuz error appear only when I update to 1.4.4
Attachments (0)
Change History (5)
Changed January 19, 2011 03:46PM UTC by comment:1
owner: | → sirio3mil@gmail.com |
---|---|
status: | new → pending |
Changed January 19, 2011 04:30PM UTC by comment:2
status: | pending → new |
---|
Itís imposible reproduce exactly on jsFiddle cuz they validate when isn't a correct json
My case is like http://jsfiddle.net/sirio3mil/ndGsV/
But you cann´t see the error in that url so you can see the in something like this http://jsfiddle.net/sirio3mil/WqHX9/
Hoping to be usefull
Changed January 19, 2011 04:43PM UTC by comment:3
Why would you send it an invalid object?
Changed January 19, 2011 04:57PM UTC by comment:4
the point isn´t that I send an invalid object (it was a problem in my code) the point is in jquery 1.4 the script don´t launch an error cuz the object is empty or null but in 1.4.4 the script launch an unexpected error, thats the point
Changed January 19, 2011 05:18PM UTC by comment:5
component: | unfiled → misc |
---|---|
priority: | undecided → low |
resolution: | → invalid |
status: | new → closed |
This test case shows that jQuery.each always throws an error when it gets passed null as argument (in all 1.4.X versions and the current 1.5b1 release). So the behavior is consistent across versions.
Anyway this wouldn't be a bug as passing null to jQuery.each isn't a valid thing to do according to the API and is thus bound to trigger unspecified behavior or throw an exception.
Thanks for submitting a ticket to the jQuery Bug Tracker!. Please provide a reduced jsFiddle.net test case that reproduces the issue to help us fully evaluate your ticket.