You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Emond Papegaaij (JIRA)" <ji...@apache.org> on 2014/08/25 16:01:17 UTC

[jira] [Commented] (WICKET-5682) AbstractAjaxTimerBehavior fails to trigger

    [ https://issues.apache.org/jira/browse/WICKET-5682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14109123#comment-14109123 ] 

Emond Papegaaij commented on WICKET-5682:
-----------------------------------------

I've been able to verify this behavior with our application, using the following code:
{code}
response.render(OnLoadHeaderItem.forScript("console.log('wicket window load');"));
response.render(OnDomReadyHeaderItem.forScript("console.log('dom ready');"));
response.render(JavaScriptHeaderItem.forScript("jQuery(window).on('load', function() {console.log('js window load');});", "test"));
{code}

Sometimes it shows:
{code}
dom ready
js window load
wicket window load 
{code}

But sometimes it shows:
{code}
js window load
dom ready
{code}

This proves that the load event is not always triggered after dom ready (at least not the jQuery dom ready event). I'll try to fix the bug with the code snippet I added to the bug description.

> AbstractAjaxTimerBehavior fails to trigger
> ------------------------------------------
>
>                 Key: WICKET-5682
>                 URL: https://issues.apache.org/jira/browse/WICKET-5682
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.16.0
>         Environment: Chrome 36
>            Reporter: Emond Papegaaij
>            Assignee: Emond Papegaaij
>
> AbstractAjaxTimerBehavior fails to trigger in some circumstances. Wicket.Event.add is called to trigger Wicket.Timer.set on the load event. The code in Wicket.Event.add adds a domready listener, which registers the onload listener as soon as the dom is ready. However, the browser fires onload before it fires domready, therefore the registered listener is never triggered and Wicket.Timer.set is not called.
> I'm not sure if this behavior is specific to recent versions of Google Chrome, but it happens quite consistently (but not always). I think a special case for onload is needed:
> $(window).load(function() {
>     $(document).ready(function() { ... });
> });



--
This message was sent by Atlassian JIRA
(v6.2#6252)