twinstone / tdi

Turbocharged DOM Infusion
Apache License 2.0
6 stars 1 forks source link

Submitting form containing file data via TDI with jQuery v1.10.1 and IE11 fails #8

Closed msevcenko closed 8 years ago

msevcenko commented 8 years ago

Fails with error in Sizzle.setDocument in the following code:

    // Support: IE>8
    // If iframe document is assigned to "document" variable and if iframe has been reloaded,
    // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
    if ( parent && parent.frameElement ) {
        parent.attachEvent( "onbeforeunload", function() {
            setDocument();
        });
    }

parent.attachEvent being undefined in IE11.

msevcenko commented 8 years ago

With normal TDI request, the node argument of the Sizzle.setDocument contains XMLDocument object, having no parentWindow, so no onbeforeunload is bound. If the TDI submits form with file data, the submit is via iframe rather than via AJAX, and the argument node for some reason contains Document object, which has a parentWindow, so IE attempts to bind and event and crashes.

The code is called from within the _success handler of TDI, namely by the code $xml.find( 'status' );.

msevcenko commented 8 years ago

Looks like this is a jQuery problem, may be related to https://bugs.jquery.com/ticket/13936, upgrading to 1.12.4 seems to fix the problem.

centi commented 8 years ago

Could you try version 1.10.2 as well? Does it also fix the problem?

msevcenko commented 8 years ago

Confirmed. Looks like the bug is fixed between 1.10.1 and 1.10.2.

centi commented 8 years ago

I updated the documentation, stating that the minimum required version of jQuery is now 1.10.2 and added a warning to the code as well.