URL comparison fails in IE8

The W3C standard says that setAttribute/getAttribute on any DOM element is
a simple setter/getter thing. IE8 tries to be smarter and returns the full
URL when calling getAttribute('src') on an image instead of the one that
was set with setAttribute('src').

This change makes sure that urls are compared properly, also in IE8.
This commit is contained in:
ahocevar
2013-04-24 15:41:04 +02:00
parent 11977f57a3
commit 2782fa47c8
2 changed files with 17 additions and 5 deletions

View File

@@ -7,6 +7,7 @@
/**
* @requires OpenLayers/Tile.js
* @requires OpenLayers/Animation.js
* @requires OpenLayers/Util.js
*/
/**
@@ -317,7 +318,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
this.layer.div.appendChild(this.getTile());
this.events.triggerEvent(this._loadEvent);
var img = this.getImage();
if (this.url && img.getAttribute("src") == this.url) {
if (this.url && OpenLayers.Util.isEquivalentUrl(img.src, this.url)) {
this._loadTimeout = window.setTimeout(
OpenLayers.Function.bind(this.onImageLoad, this), 0
);