You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Funk (JIRA)" <ji...@apache.org> on 2007/08/15 22:37:30 UTC

[jira] Issue Comment Edited: (WICKET-480) IHeaderResponse.renderOnUnLoadJavascript(String javascript);

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

funkattack edited comment on WICKET-480 at 8/15/07 1:35 PM:
-------------------------------------------------------------

So how about something like this? (see attached 'diff.txt')
Support events that are compatible in all browsers and also allow developers to add javascript to events that they demand for explicitly.

Btw, what's a well recogniced resource on compatability issues between the different browsers? As you have seen I currntly can come up with quirksmode and wikipedia.

      was (Author: funkattack):
    So how about something like this?
Support events that are compatible in all browsers and also allow developers to add javascript to events that they demand for explicitly.

Btw, what's a well recogniced resource on compatability issues between the different browsers? As you have seen I currntly can come up with quirksmode and wikipedia.
  
> IHeaderResponse.renderOnUnLoadJavascript(String javascript);
> ------------------------------------------------------------
>
>                 Key: WICKET-480
>                 URL: https://issues.apache.org/jira/browse/WICKET-480
>             Project: Wicket
>          Issue Type: New Feature
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Martin Funk
>            Assignee: Matej Knopp
>            Priority: Minor
>             Fix For: 1.3.0-beta3
>
>         Attachments: diff.txt
>
>
> Where there is a renderOnLoadJavascript there ought to be a renderOnUnLoadJavascript too.
> This is all just copy past, so it's a little smelly.
> Beyond that I wouldn't mind to be able to specify which element an event should be added.
> Index: wicket/src/main/java/org/apache/wicket/markup/html/internal/HeaderResponse.java
> ===================================================================
> --- wicket/src/main/java/org/apache/wicket/markup/html/internal/HeaderResponse.java     (Revision 529942)
> +++ wicket/src/main/java/org/apache/wicket/markup/html/internal/HeaderResponse.java     (Arbeitskopie)
> @@ -197,4 +197,19 @@
>                 }
>         }
>  
> +       /**
> +        * @see org.apache.wicket.markup.html.IHeaderResponse#renderOnUnLoadJavascript(java.lang.String)
> +        */
> +       public void renderOnUnLoadJavascript(String javascript)
> +       {
> +               List token = Arrays.asList(new Object[] { "javascript-event", "unload", javascript });
> +               if (wasRendered(token) == false)
> +               {
> +                       renderJavascriptReference(WicketEventReference.INSTANCE);
> +                       JavascriptUtils.writeJavascript(getResponse(),
> +                                       "Wicket.Event.add(window, \"unload\", function() { " + javascript + ";});");
> +                       markRendered(token);
> +               }
> +       }
> +
>  }
> Index: wicket/src/main/java/org/apache/wicket/markup/html/IHeaderResponse.java
> ===================================================================
> --- wicket/src/main/java/org/apache/wicket/markup/html/IHeaderResponse.java     (Revision 529942)
> +++ wicket/src/main/java/org/apache/wicket/markup/html/IHeaderResponse.java     (Arbeitskopie)
> @@ -174,4 +174,11 @@
>          * @param javascript
>          */
>         public void renderOnLoadJavascript(String javascript);
> +
> +       /**
> +        * Renders javascript that is executed after the page is unloaded.
> +        * 
> +        * @param javascript
> +        */
> +       public void renderOnUnLoadJavascript(String javascript);
>  }

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