Skip to main content

Bug Tracker

Side navigation

#2231 closed bug (invalid)

Opened January 24, 2008 05:18PM UTC

Closed January 25, 2008 10:57PM UTC

Opera - $.each Bug

Reported by: bugmaster Owned by:
Priority: trivial Milestone: 1.2.3
Component: core Version: 1.2.2
Keywords: Cc:
Blocked by: Blocking:
Description

$.each(....) <-- why is this starting at 10 with OPERA? 10 11 12 13 .... 30 31 01 02 03 04 05 06 07 08 09

$.getJSON("calendar.php", { action: "show_dates", year: y, month: m }, function(json) {

$.each(json, function(x) {

});

});

json data...

{"01":[{"id":"5","_from":"2007-12-29","_to":"2008-01-02","title":"gh","location":"fj"}],"02":[{"id":"5","_from":"2007-12-29","_to":"2008-01-02","title":"gh","location":"fj"},{"id":"3","_from":"2008-01-02","_to":"2008-01-02","title":"asd","location":"asd"},{"id":"7","_from":"2008-01-02","_to":"2008-01-02","title":"asd","location":"asdads"}],"03":[],"04":[],"05":[],"06":[],"07":[],"08":[],"09":[{"id":"4","_from":"2008-01-09","_to":"2008-01-14","title":"Klaus Hochzeit","location":"Nuernberg"}],"10":[{"id":"4","_from":"2008-01-09","_to":"2008-01-14","title":"Klaus Hochzeit","location":"Nuernberg"}],"11":[{"id":"4","_from":"2008-01-09","_to":"2008-01-14","title":"Klaus Hochzeit","location":"Nuernberg"}],"12":[{"id":"4","_from":"2008-01-09","_to":"2008-01-14","title":"Klaus Hochzeit","location":"Nuernberg"}],"13":[{"id":"4","_from":"2008-01-09","_to":"2008-01-14","title":"Klaus Hochzeit","location":"Nuernberg"}],"14":[{"id":"4","_from":"2008-01-09","_to":"2008-01-14","title":"Klaus Hochzeit","location":"Nuernberg"}],"15":[],"16":[],"17":[{"id":"8","_from":"2008-01-17","_to":"2008-01-17","title":"asd","location":"asd"}],"18":[],"19":[],"20":[{"id":"9","_from":"2008-01-20","_to":"2008-01-21","title":"asd","location":"asd"}],"21":[{"id":"9","_from":"2008-01-20","_to":"2008-01-21","title":"asd","location":"asd"}],"22":[],"23":[{"id":"2","_from":"2008-01-23","_to":"2008-01-31","title":"Peter Hochzeit","location":"Duesseldorf"}],"24":[{"id":"2","_from":"2008-01-23","_to":"2008-01-31","title":"Peter Hochzeit","location":"Duesseldorf"}],"25":[{"id":"2","_from":"2008-01-23","_to":"2008-01-31","title":"Peter Hochzeit","location":"Duesseldorf"}],"26":[{"id":"2","_from":"2008-01-23","_to":"2008-01-31","title":"Peter Hochzeit","location":"Duesseldorf"}],"27":[{"id":"2","_from":"2008-01-23","_to":"2008-01-31","title":"Peter Hochzeit","location":"Duesseldorf"}],"28":[{"id":"2","_from":"2008-01-23","_to":"2008-01-31","title":"Peter Hochzeit","location":"Duesseldorf"}],"29":[{"id":"2","_from":"2008-01-23","_to":"2008-01-31","title":"Peter Hochzeit","location":"Duesseldorf"},{"id":"1","_from":"2008-01-29","_to":"2008-01-31","title":"haha","location":"ohiasoid"}],"30":[{"id":"2","_from":"2008-01-23","_to":"2008-01-31","title":"Peter Hochzeit","location":"Duesseldorf"},{"id":"1","_from":"2008-01-29","_to":"2008-01-31","title":"haha","location":"ohiasoid"}],"31":[{"id":"2","_from":"2008-01-23","_to":"2008-01-31","title":"Peter Hochzeit","location":"Duesseldorf"},{"id":"1","_from":"2008-01-29","_to":"2008-01-31","title":"haha","location":"ohiasoid"}]}

Attachments (0)
Change History (2)

Changed January 24, 2008 05:36PM UTC by davidserduke comment:1

It's my understanding that when a for-in is used there is currently no guarantee what order the properties will be iterated. In fact this is one of the ECMA 3 bugs that is supposed to be fixed in ECMA 4.

http://ejohn.org/blog/bug-fixes-in-javascript-2/

If I had to guess I'd think opera is returning all the numbers first and the strings second. And it sees "01" as a string.

Try iterating like:

  for (var i = 1; (obj = json[(i < 10 ? "0" : "") + i]); i++) {
    fn(obj);
  }

There is probably a better way but this is the first one that comes to mind.

Changed January 25, 2008 10:57PM UTC by davidserduke comment:2

resolution: → invalid
status: newclosed