Skip to main content

Bug Tracker

Side navigation

#3703 closed bug (worksforme)

Opened December 09, 2008 04:26PM UTC

Closed October 21, 2010 07:52PM UTC

IMG tag creation/append is not working in Opera 9.52

Reported by: delf Owned by:
Priority: minor Milestone: 1.3
Component: core Version: 1.2.6
Keywords: jsonp, opera Cc:
Blocked by: Blocking:
Description

this example from page http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback

$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
        function(data){
          $.each(data.items, function(i,item){
            $("<img/>").attr("src", item.media.m).appendTo("#images");
            if ( i == 4 ) return false;
          });
        });

is not working in Opera 9.5

Attachments (2)
  • jquery_test.2.html (0.6 KB) - added by aaron.gundel January 08, 2009 09:38PM UTC.

    slightly modified replication

  • jquery_test.html (0.4 KB) - added by davidserduke January 08, 2009 10:21AM UTC.
Change History (6)

Changed January 08, 2009 03:45AM UTC by aaron.gundel comment:1

Appears to be relevant in 9.63 also. Does not appear to be related to JSONP though: I tried replicating and found that the JSONP executes properly and returns links to the photos as expected; but the manipulation code appears to be failing.

Changed January 08, 2009 10:21AM UTC by davidserduke comment:2

component: ajaxcore
summary: getJSON JSONP is not working in Opera 9.52IMG tag creation/append is not working in Opera 9.52

Aaron appears to be correct and this has nothing to do with JSONP. The URLs seem to be coming back fine and it is the creation of the IMG tags and appending them to the DIV that seems to have the problem.

That being the case I'm going to change the summary to reflect the issue.

Changed January 08, 2009 10:26AM UTC by davidserduke comment:3

description: this example from page http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback \ \ $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?", \ function(data){ \ $.each(data.items, function(i,item){ \ $("<img/>").attr("src", item.media.m).appendTo("#images"); \ if ( i == 4 ) return false; \ }); \ }); \ is not working in Opera 9.5this example from page http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback \ \ {{{ \ $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?", \ function(data){ \ $.each(data.items, function(i,item){ \ $("<img/>").attr("src", item.media.m).appendTo("#images"); \ if ( i == 4 ) return false; \ }); \ }); \ }}} \ is not working in Opera 9.5
priority: majorminor

Attached a simplified test case. To my eye this appears to be a browser bug. The test case works in FF2 and IE7, but not Opera 9.52. Also works in Opera 9.26 so hopefully they will fix it. I'm not sure how jQuery could provide a fix so we might have to close this ticket regardless.

Changed January 08, 2009 09:41PM UTC by aaron.gundel comment:4

This is an interesting issue. Appears to be happening because of the use of the $("<img/>") call to create an element. The DOM is properly manipulated (you can see the img appear under the body), but the image doesn't load for some reason. Found that if you have a second call right after the appendChild call using an element made from document.createElement("img") this succeeds. This is indeed probably a browser bug. Will submit report on it and see if that goes anywhere...

Changed August 06, 2009 09:21PM UTC by victor.lima comment:5

Work-around for this bug, tested to work on Opera 9.64

After you have appended to the element you have to do this:

$(element).css("visibility", "visible");

That worked like a charm for us.

Changed October 21, 2010 07:52PM UTC by addyosmani comment:6

resolution: → worksforme
status: newclosed

The original example in the docs page is working fine on Opera 9.5 and latest on OSX using jQuery 1.4.3. I believe this issue should be fixed and working now.