Skip to main content

Bug Tracker

Side navigation

#11049 closed bug (fixed)

Opened December 17, 2011 11:27AM UTC

Closed March 07, 2012 12:58AM UTC

Last modified March 07, 2012 01:24PM UTC

submit can not be stopped in ie when bubbling

Reported by: yiminghe Owned by: dmethvin
Priority: high Milestone: None
Component: event Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

1. input the following html:

<div id='t'>
    <form id='f'>
        <input type='submit' id='s'/>

<script src='jquery-1.7.1.js'></script>

        var ret=[];
        // trigger jquery's submit hack

2. run it in ie

expected : alert(true)

actual result : alert(false)

PS : Maybe event "change" in ie has the same problem,i will check it later.

PS2 : I try to fix this bug in KISSY (which learned a lot from jquery),hope it is feasible for jquery too.

1. place event "submit" fix hander as the last handler always :

2. do nothing in submit fix handler if user called stopPropagation in his handler:

After above fixes the result is fine :

Attachments (0)
Change History (7)

Changed December 17, 2011 11:33AM UTC by yiminghe comment:1

_comment0: sorry , open in ie and other browsers :

sorry , open in ie and other browsers :

Changed December 17, 2011 03:27PM UTC by dmethvin comment:2

owner: → dmethvin
status: newassigned

Yep, I agree about the bug. Making sure the event runs last will be tricky though, given that other code can attach events later.

Changed December 19, 2011 02:03AM UTC by yiminghe comment:3

yes, it is tricky, especially making sure the submit fix event runs last always even user attach event later , so it need to modify "event add" , and record lastCount ,always place user's event handler before submit fix :

The above steps fix this bug perfectly, hope you can find a better way

Changed January 13, 2012 01:47AM UTC by dmethvin comment:4

component: unfiledevent
priority: undecidedhigh

Changed March 07, 2012 12:58AM UTC by Dave Methvin comment:5

resolution: → fixed
status: assignedclosed

Fix #11049. Let bubbling submit be cancellable in oldIE.

Changeset: 92a92be10f2c6eecc93e0def9001a2ef2852fde1

Changed March 07, 2012 06:57AM UTC by yiminghe comment:6

@Dave Methvin

Still not perfect :) , open in ie :

But i think the current solution is fine in real world.

Changed March 07, 2012 01:24PM UTC by dmethvin comment:7

I agree, any inline handlers may not work properly. We try to make inline handlers work where possible, but they are bad practice and hard to fix since they are outside our event model. Thanks for your help yiminghe!