-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Closed
Labels
Milestone
Description
When you use an input with form attribute while also handling the document's submit event you get an error in IE8.
Here's an easy way to reproduce it.
<html>
<body>
<input type="text" form="test">
<form action="" id="test"></form>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script>
$(document).on('submit', 'form', function () {});
</script>
</body>
</html>When you click the input in IE8 you get this error.
Here's a jsfiddle http://jsfiddle.net/1g19xt3p/1/
And since jsfiddle doesn't work in IE8 here's a direct link to the result https://jsfiddle.net/1g19xt3p/1/embedded/result/
A small research showed that here's the code responsible
jQuery.event.special.submit = {
setup: function() {
// skipped
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "submitBubbles" ) ) {
// skipped
}
});
},
// skippedThe thing is elem.form returns the form attribute value in IE8 that is a String and jQuery can't get the data out of a String.
