Skip to content

Removing parent node during event bubbling doesn't have the same result as pure javascript code #2918

@Getfree

Description

@Getfree

In the following code, clicking the button triggers a form submission in Google Chome 48.

<form>
    <button>ok</button>
</form>
<script>
$(function(){
    $('form').submit(false) ;
    $('button').click(function(){ $('form').remove() }) ;
}) ;
</script>

However, the same test case without using jQuery does not trigger a form submission.

<form onsubmit="return false">  
    <button onclick="form.remove()">ok</button>
</form>

What's the expected behavior?
Both examples should be functionally equivalent.

Browsers affected: Google Chrome 48
jQuery version tested: jQuery 2.2

Also tested in Firefox 43, but the problem does not happen there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions