vikramjitsaha / biojs

Automatically exported from code.google.com/p/biojs
0 stars 0 forks source link

Chebi compound has a bug in iE #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It seems that the BIOJS Chebi compound has a bug in iE…

Ilinca (CC) pointed this out and she fixed it commenting the if block, leaving 
the else part only:

now it is like this:

                .load(function() {
                    if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
                        self._imageContainer.addClass("noImage");
                        self.raiseEvent( Biojs.ChEBICompound.EVT_ON_REQUEST_ERROR, {
                            id: chebiId,
                            url: url,
                            message: "No image available"
                        });

                    } else {
                        self._imageContainer.removeClass("noImage");
                        self._imageContainer.append(image).css({
                            'width': self.opt.imageDimension,
                            'height': self.opt.imageDimension,
                            'margin': 'auto'
                        });

                        self.raiseEvent( Biojs.ChEBICompound.EVT_ON_IMAGE_LOADED, {
                            id: chebiId,
                            url: url
                        });
                    }
                })

And I think she left only the else part:

                .load(function() {

                        self._imageContainer.removeClass("noImage");
                        self._imageContainer.append(image).css({
                            'width': self.opt.imageDimension,
                            'height': self.opt.imageDimension,
                            'margin': 'auto'
                        });

                        self.raiseEvent( Biojs.ChEBICompound.EVT_ON_IMAGE_LOADED, {
                            id: chebiId,
                            url: url
                        });

                })

Original issue reported on code.google.com by rajido@gmail.com on 18 Mar 2013 at 11:04

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r473.

Original comment by rajido@gmail.com on 18 Mar 2013 at 11:04

GoogleCodeExporter commented 9 years ago
Thanks! I fix it this way ...

        image = jQuery('<img id="image_' + chebiId + '"/>')
            .load(function() {
                   self._imageContainer.removeClass("noImage");
                   self._imageContainer.append(image).css({
                        'width': self.opt.imageDimension,
                        'height': self.opt.imageDimension,
                        'margin': 'auto'
                   });

                   self.raiseEvent( Biojs.ChEBICompound.EVT_ON_IMAGE_LOADED, {
                       id: chebiId,
                       url: url
                   });
            })
            .error(function() {
                self._imageContainer.addClass("noImage");
                self.raiseEvent( Biojs.ChEBICompound.EVT_ON_REQUEST_ERROR, {
                    id: chebiId,
                    url: url,
                    message: "No image available"
                });
            })
            .attr('src', url);

Original comment by rajido@gmail.com on 18 Mar 2013 at 11:06