It seems that in IE, some delegates might somehow cause the other delegate to fail.
This is one of the possible cases:
<html>
<head>
<script src='jquery-1.4.2.min.js'></script>
<script>
$(function() {
$('#main')
.delegate('div', 'click', function() {
alert('on div!');
})
.delegate('[name=first]', 'change', function() {
alert('first!');
})
.delegate('[name=second]', 'change', function() {
alert('second!');
})
;
});
</script>
</head>
<body>
<div id="main">
<input name="first" />
<input name="second" type="checkbox" />
<div>Test</div>
</div>
</body>
</html>
In this particular case, the handler for the flag will not fire.
As usual, the problem does not appear in other browsers.
Changing call orders may solve the problem, but runs the risk of causing another. Please note that the delegate is working on mutually exclusive elements, so the order should be irrelevant.
What causes this?
source
share