I need compatible JavaScript code for document.createElementNS () in older versions of IE

JavaScript feature document.createElementNS()

not working in older versions of IE (6,7,8)? Is there any compatible code for this feature, like a Array

compatible map feature for older IE version?

+3


source to share


1 answer


Take a look at the following post from the google group. There's a workaround that might help you: http://code.google.com/p/svgweb/issues/detail?id=625

Workaround (from the link above):



window.onload = function() {
    function onCreateElementNsReady(func) {
        if (document.createElementNS != undefined) {
            func();
        } else {
            setTimeout(function() { onCreateElementNsReady(func); }, 100);
        }
    }

    onCreateElementNsReady(function() {
        var svg = document.createElementNS(svgns, 'svg');
        // ...
    });
};

      

+2


source







All Articles