GithubHelp home page GithubHelp logo

Make testsuite work on IE9 about dompurify HOT 8 CLOSED

cure53 avatar cure53 commented on July 24, 2024
Make testsuite work on IE9

from dompurify.

Comments (8)

fhemberger avatar fhemberger commented on July 24, 2024

Nope, it's this statement: https://github.com/cure53/DOMPurify/blob/master/purify.js#L178

/* Cover IE9's buggy outerHTML behavior */
if(dom.body === null) {
    dom.body.innerHTML = dirty;
}

I don't know what your original intention was … ;)


Second issue: https://github.com/cure53/DOMPurify/blob/master/test/index.html#L29

QUnit.assert.contains = function( needle, haystack, message ) {
    var actual = haystack.indexOf(needle) > -1;
    QUnit.push(actual, actual, needle, message);
};    

This doesn't seem to work when you return early and return an empty sting (https://github.com/cure53/DOMPurify/blob/master/purify.js#L390) (cc @mathiasbynens):

Expected:  ""
Result:  false

from dompurify.

cure53 avatar cure53 commented on July 24, 2024

In IE9, outerHTML and innerHTML in virtual documents is broken. The seemingly hackish code covers that and enables DOMPurify to work fine nevertheless. Unfortunately the tests disagree. Workarounds are welcome :)

from dompurify.

fhemberger avatar fhemberger commented on July 24, 2024

Well, null shouldn't be an object and have any properties. And it's exactly this line that breaks all the tests in IE9, because of the attempt to write to null.innerHTML.

from dompurify.

codylindley avatar codylindley commented on July 24, 2024

This is breaking for me in ie9 (not the tests).

https://www.dropbox.com/s/mb490tr9xpxu080/Screenshot%202014-04-15%2014.51.43.png

from dompurify.

codylindley avatar codylindley commented on July 24, 2024

I'm not sure the intent, but using innerHTML instead of outer, works. But it might negate your intention.

from dompurify.

cure53 avatar cure53 commented on July 24, 2024

I am currently revising this issue, you guys are right. Additional code is needed for IE9 to work fine.

from dompurify.

cure53 avatar cure53 commented on July 24, 2024

I added a fix for the innerHTML issue shown above, yet are close to believe that based on the flawed outerHTML behavior on MSIE9 we might not be able to fully support this browser.

I ran the tests and they do work now - but many of them yield results that are beyond reason (closing <body> element in the middle of a HTML string, double-open links, absurd XML processing instructions for MathML strings etc.).

So far my conclusion is: DOMPurify works on IE9, produces safe output, but to make all tests go green we'd have to start accepting absurd HTML that might have structural flaws and produce results we cannot observe on any other browser. Thoughts?

from dompurify.

cure53 avatar cure53 commented on July 24, 2024

Closed for inactivity, no bug reports from IE9. Re-open if necessary.

from dompurify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.