submit events on forms not caught in IE6
| Project: | Listen |
| Version: | 1.0.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
Using listen to catch submit events on forms does not work. The forms will submit normally.
A simple test case is attached. In Firefox, both alerts will pop. In IE6, only the bound event will pop and the form will submit normally.
I am using jQuery 1.2.6 and Listen 1.0.3. In the production code I found the bug in, I am indeed using event.preventDefault() (which never gets called) as well as selecting by class instead of by the form element. It does not seem to matter what sort of selector I use.
| Attachment | Size |
|---|---|
| Test case | 528 bytes |

Comments
#1
I am not sure the attachment worked correctly, so here is the testcase:
<html><head>
<title>Internet Explorer + jQuery Listen submit testcase</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.listen.js"></script>
<script type="text/javascript">
$(function() {
$.listen('submit', 'form', function(event) {
alert('form submit listen');
});
$('form').submit(function(event) {
alert('form submit bound');
});
});
</script>
</head>
<body>
<form>
<input type="submit">
</form>
</body>
</html>
#2
In case it might be helpful to look at it, I wanted to note that I did just find out submit events work properly with Live Query.
#3
submit events don't bubble on IE, that's why they can't be handled with Listen unless a hack is used ( I haven't added any to Listen yet ).
This is specified on the docs.
LiveQuery does work because it uses rebinding, instead of event delegation.
This isn't a bug, just a fact.