Hi Korbinian,
using the "defer" attribute on script tags in the head section seems to
be best practice now:
https://www.shivering-isles.com/the-science-of-loading-javascript/
Wicket supports the attribute since
https://issues.apache.org/jira/browse/WICKET-5715
Have fun
Sven
Am 07.10.2017 um 19:49 schrieb Korbinian Bachl:
Hi,
currently wicket renders all its jQuery and Ajax stuff right into the head, and
I wonder why.
Current best practice seems to defer all javascript till the end of the page just right before the closing </body> tag to let the browser meanwhile get the DOM and do some work and not get blocked by loading resources. So wouldnt it maybe with wicket 8 be a good time to change this?
e.g. Do
<body>
all the stuff
<script type="text/javascript"
src="../wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery.js"></script>
<script type="text/javascript">
ajax stuff...
</script>
</body>
by default? and since mostly today jQuery is already on the page maybe even
allow to apply a null at the
getJavaScriptLibrarySettings().setJQueryReference(null); to not have a wicket
reference on it at all? Many webapps nowadays tend to only have 1 app.js that
includes everything as its often build by tools like webpack.
Would this be a good or bad idea?
Best,
Korbinian
PS: in wicket 8 jquery 2.x is interchangable with jquery 3.x, am I right?