wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: javascript reference header item with async attribute
Date Mon, 16 Jun 2014 10:48:25 GMT
Hi,

I don't like the number of constructors we have in the different impls of
CssHeaderItem and JavaScriptHeaderItem.
Recently I needed to set markup id to a CssHeaderItem to be able to replace
it with Ajax so I've added a new method [1] to CssHeaderItem: setId(String)
[2] that uses Fluent API pattern, i.e. returns "this".
Usage:  render(CssHeaderItem.forXyz(...).setId("someId"));

"async" is a new attribute added with HTML5 and is different than "defer"
I think we can do the same and add it without changing the current APIs,
i.e. adding more constructors/methods.
The usage would be: render(CssHeaderItem.forXyz(...).setAsync(true));

If you like the idea then please open a ticket at
https://issues.apache.org/jira/browse/WICKET

1. https://issues.apache.org/jira/browse/WICKET-5617
2.
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java#L80

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 9, 2014 at 4:45 PM, Simon B <simon.botting@gmail.com> wrote:

> Hello Andrea,
>
> Thank you for replying.  In the end I subclassed
> JavaScriptUrlReferenceHeaderItem creating my own
> AsyncJavaScriptUrlReferenceHeaderItem class
>
> and overrode the
>
>  public void render(Response response);
>
> method, take as a reference the implemenation from
> JavaScriptUtils.writeJavaScriptUrl and JavaScriptUrlHeaderItem and simply
> adding a async attribute in one of the response.write method calls:
>
>
>
> Seems a bit of a brutish way just to add an async attribute.
>
> Is this something that could // should be added to a future release of
> wicket, does anyone have any opinion about it?
>
> Cheers
> Simon
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/javascript-reference-header-item-with-async-attribute-tp4666155p4666159.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message