shawnbot / aight

JavaScript shims and shams for making IE8-9 behave reasonably
Other
756 stars 98 forks source link

IE8 error on DispHTMLDocument.createElementNS #28

Closed knownasilya closed 10 years ago

knownasilya commented 10 years ago

See this line of code in D3, the part that breaks IE8 is this.ownerDocument.createElementNS. We currently have a shim for createElementNS for document, but I suppose we need to put it on the underlying element.. DispHTMLDocument, according to IE8 :neckbeard:

shawnbot commented 10 years ago

Good catch. mbostock/d3@b641eb58b387a1e9804ba6ff35ae70ab494c2b09 from 5 months ago fixed mbostock/d3#1533, but introduced the issue for aight. Our shim should add createElementNS to the prototype, not to the document instance.

knownasilya commented 10 years ago

Also, could you check if the current createElementNS is reached when aight.js is executed.. Either I'm doing something wrong, or there is an issue somewhere.

usmonster commented 10 years ago

Could this be a fix:

if (!('createElementNS' in HTMLDocument.prototype)) {
    HTMLDocument.prototype.createElementNS = function(ns, name) {
        if (ns) throw "sorry, this browser does not support namespaces";
        return HTMLDocument.prototype.createElement.call(this, name);
    };
}

? Let me know, and I'll put it in a pull request.

shawnbot commented 10 years ago

Yep, that should do it.