amplesdk
amplesdk copied to clipboard
<img /> with @src does not work in IE9
If img is created from string it does not load content in IE9. The following code works in FF, Chrome, IE10 but not in IE9 (standard mode):
ample.query('<img src="icon.png" />').appendTo(ample.documentElement);
As workaround I modified xhtml.js - added DOMNodeInsertedIntoDocument handler
cXHTMLElement_img.handlers = {
"DOMNodeInsertedIntoDocument": function(oEvent) {
var aIE = window.navigator.userAgent.match(/MSIE\s(\d+\.\d+)/),
bIE9 = aIE && (1 * aIE[1] == 9);
if (bIE9 && this.hasAttribute('src')){
var oThis = this;
(function waitState() {
var img = oThis.$getContainer(),
st = img.readyState;
if (st == 'uninitialized') {
img.src = '';
img.src = oThis.getAttribute('src');
setTimeout(waitState, 250);
}
})();
}
}
};