Skip to content

jquery live event with default action #9

Description

@svenfuchs

[moving this issue here ...]

Suppose I have a document like this one:

  <html>
    <head>
      <title></title>
      <script src="/javascripts/jquery-1.4.2.js" type="text/javascript"></script>
      <script>
        $(document).ready(function() {
          $('a.clickable').live('click', function(event) {
            document.title = 'live click event triggered';
            return false;
          });
        });
      </script>
    </head>
    <body>
      <a href='/foo' class='clickable'>link</a>
    </body>
  </html>

Then the event handler should be called (i.e. document.title set to 'live click event triggered') and the default action of the link (i.e. the request to /foo) should not happen.

What actually happens is: the request to /foo happens first and the event handler is called afterwards.

Jquery registers a live event handler to the topmost dom node, so the handler will be called after the event has bubbled up the entire tree. In envjs 0.3.4 event bubbling seems to happen at the very end of the __dispatchEvent__ method after default actions have been evaluated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions