Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<img /> with @src does not work in IE9 #186

Open
tedbeer opened this issue Apr 3, 2013 · 1 comment
Open

<img /> with @src does not work in IE9 #186

tedbeer opened this issue Apr 3, 2013 · 1 comment

Comments

@tedbeer
Copy link

tedbeer commented Apr 3, 2013

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);
@tedbeer
Copy link
Author

tedbeer commented Apr 5, 2013

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);
                }
            })();
        }
    }
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant