You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Kristian Marinkovic (JIRA)" <ta...@jakarta.apache.org> on 2007/02/12 10:27:05 UTC

[jira] Commented: (TAPESTRY-1241) @EventListener produces multiple events

    [ https://issues.apache.org/jira/browse/TAPESTRY-1241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472228 ] 

Kristian Marinkovic commented on TAPESTRY-1241:
-----------------------------------------------

hi jesse,

i just did a clean checkout and built tapestry 4.1.2-SNAPSHOT on my local machine.
After starting up tomcat i could reproduce the bug  (btw. some test fail :)).

The javascript code of the page looks like this when first started:

dojo.addOnLoad(function(e) {
dojo.require("tapestry.form");tapestry.form.registerForm("Form");
tapestry.form.focusField('iteration');
tapestry.cleanConnect(dojo.byId("ul"), "onclick", "event1675372791");
                tapestry.event1675372791=function(e){
                    var content={beventname:"onclick"};
                    tapestry.event.buildEventProperties(e, content);
                    if (!content["beventtarget.id"]) {
                    	content["beventtarget.id"]="ul";
                    }
                    tapestry.bind("/event/app?component=ul&page=Home&service=directevent", content);
                };
                dojo.event.connect(dojo.byId("ul"), "onclick", tapestry, "event1675372791");});

When i then click on the first item it outputs "list" correctly into my console. 
Reloading the page then with the submit link returns following javascript code, that causes the
multiple events:

dojo.addOnLoad(function(e) {
dojo.require("tapestry.form");tapestry.form.registerForm("Form");
tapestry.form.focusField('iteration');
tapestry.cleanConnect(dojo.byId("ul"), "onclick", "event1675372791");
                tapestry.event1675372791=function(e){
                    var content={beventname:"onclick"};
                    tapestry.event.buildEventProperties(e, content);
                    if (!content["beventtarget.id"]) {
                    	content["beventtarget.id"]="ul";
                    }
                    tapestry.bind("/event/app?component=ul&page=Home&service=directevent", content);
                };
                dojo.event.connect(dojo.byId("ul"), "onclick", tapestry, "event1675372791");
tapestry.cleanConnect(dojo.byId("list"), "onclick", "event526584677");
                tapestry.event526584677=function(e){
                    var content={beventname:"onclick"};
                    tapestry.event.buildEventProperties(e, content);
                    if (!content["beventtarget.id"]) content["beventtarget.id"]="list";
                    tapestry.bind("/event/app?component=ul&page=Home&service=directevent", content);
                };
                dojo.event.connect(dojo.byId("list"), "onclick", tapestry, "event526584677");});


For any event that was triggered an additional javascript block will be generated on any new 
page reload via the submit link. i suspect there is a place anywhere where there is some sort
of state information where it shouldn't be. Or maybe the events are missinterpreted as additional
@EventListener annotations. i must admit i was not able to find this specific place :)

i hope this helps to reproduce the bug

ps. sorry for being so annoying :)


> @EventListener produces multiple events
> ---------------------------------------
>
>                 Key: TAPESTRY-1241
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1241
>             Project: Tapestry
>          Issue Type: Bug
>          Components: XHR/dhtml/Ajax
>    Affects Versions: 4.1.1
>         Environment: Tapestry 4.1.1 and 4.1.2-20070121
>            Reporter: Kristian Marinkovic
>         Assigned To: Jesse Kuhnert
>            Priority: Blocker
>             Fix For: 4.1.2
>
>         Attachments: EventListener.zip
>
>
> Adding an EventListener to the parent HTML element  seems to add additional
> @EventListener to the Tapestry components on every Javascript event. This results
> in the generation of multiple "tapestry.event(hash)=function..." statements although 
> only one is correct. This gets apparent when the page is submitted and re-rendered
> again.
> i added a maven2 example project to reproduce the bug.
> please follow these steps:
> 1) click on "submit"
> 2) click on the second and forth list element and watch the console (should print list-0 and list-2... the target component of the javascript event)
> 3) click again on "submit" (you might change the value if you want)
> 4) click again on the second list element and watch the console -> list-0 will appear twice
> 5) take a look at the generated page to see the multiple tapestry.event statements

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org