#176 JavaScript click events executing twice

open
nobody
None
5
2010-09-09
2010-09-09
No

If I navigate to a local html file containing the following code,

<div onclick="alert('hi')">Test</div>,

clicking "Test" often (but not always) results in two alert boxes being created.

Discussion

  • Lawrence Marigold

    I've created a patch that stops this happening, but I don't know if it breaks other functionality.

    org.lobobrowser.html.renderer.RBlock.java calls onMouseClick twice, once for bodyLayout and once for HtmlController.

    I prevented this by changing an if to an else if, but I suspect the actual resolution is more complex.

    I've attached the patch so someone more familiar with Lobo can check it out.

     
  • Lawrence Marigold

    Hmm - can't work out how to attach... :))

    Anyway, here is the patch:

    ### Eclipse Workspace Patch 1.0
    #P HTML_Renderer
    Index: org/lobobrowser/html/renderer/RBlock.java
    ===================================================================
    RCS file: /cvsroot/xamj/XAMJ_Project/HTML_Renderer/org/lobobrowser/html/renderer/RBlock.java,v
    retrieving revision 1.34
    diff -u -r1.34 RBlock.java
    --- org/lobobrowser/html/renderer/RBlock.java 5 Jul 2009 14:58:58 -0000 1.34
    +++ org/lobobrowser/html/renderer/RBlock.java 6 May 2011 20:10:42 -0000
    @@ -1110,7 +1110,7 @@
    return false;
    }
    }
    - if (!HtmlController.getInstance().onMouseClick(this.modelNode, event,
    + else if (!HtmlController.getInstance().onMouseClick(this.modelNode, event,
    x, y)) {
    return false;
    }

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks