When Uploadify is used and jQuery. Validition is used to verify the control, the JS missing object error occurs on IE11 ., Uploadifyie11
Scenario:
Use jQuery.1.8.2
Use the Uploadify 3.2 upload Control
Verify with jQuery. Validition 1.9
When you use IE 11, when you click the upload button, the JS object is missing. For example:
Locate the error in jQuery.
After troubleshooting, it is found that the jQuery Validition verification control is referenced.
In the initialization of the jQuery Validition control, the following code is provided:
$currentSection .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + "[type='email'], [type='datetime'], [type='date'], [type='month'], " + "[type='week'], [type='time'], [type='datetime-local'], " + "[type='range'], [type='color'] ", "focusin focusout keyup", delegate) .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate);
You only need to comment out the code, and the error will disappear.
Check the validateDelegate method:
123456789 |
$.fn.validateDelegate= function (delegate, type, handler) { // Verify the delegate return this .on(type, function (event) { var target = $(event.target); if (target.is(delegate)) { return handler.apply(target, arguments); } }); }; |
It only binds events to elements and has no special code.
After you try to remove the jQuery. validitioin plug-in from Html, write the following code on the current page:
123 |
$( "form" ).on( "focusin focusout keyup" , function (){ // TODO: }); |
This code will also cause the above mentioned problems.
Because the error is thrown on jQuery, go to jQuery:
123456 |
acceptData: function ( elem ) { var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; // nodes accept data unless otherwise specified; rejection can be conditional return !noData || noData !== true && elem.getAttribute( "classid" ) === noData; } |
Focus on debugging to elem. the getAttribute method is useless to other elements. However, when obtaining the object element, on IE11, The getAttribute method does not exist as null, so the preceding code is reported.
Add a judgment to the Code:
123456 |
acceptData: function ( elem ) { var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; // nodes accept data unless otherwise specified; rejection can be conditional return !noData || noData !== true && <span style= "color: #ff0000;" >elem.getAttribute != null </span> && elem.getAttribute( "classid" ) === noData; } |
This problem persists when I try to use jQuery 1.9 and 1.12. So I only changed the code of 1.8.2, and this problem occurs when the other element encounters the object.
Download the modified jquery 1.8.2:
Jquery-1.8.2-FIX_Object.getAttribute_is_Null Download
Other highlights
JQuery tutorial (29)-jQuery plug-in development-Specify parameters for plug-in Methods jQuery tutorial (28)-jQuery plug-in development-jQuery tutorial (27) -jQueryajax-Modify default options jQuery tutorial (26)-ajax-use JSONP to load Remote Data jQuery tutorial (25)-security restrictions on ajax operations