Repository: wicket
Updated Branches:
  refs/heads/master 273d479fa -> 634fd247d


WICKET-6498 unwrap recursively

use inner static classes, added details to javadoc


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/634fd247
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/634fd247
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/634fd247

Branch: refs/heads/master
Commit: 634fd247d8c2b0d3cfa01e4679d34fb256191c5f
Parents: 273d479
Author: Sven Meier <svenme...@apache.org>
Authored: Fri Feb 2 19:12:03 2018 +0100
Committer: Sven Meier <svenme...@apache.org>
Committed: Fri Feb 2 19:12:03 2018 +0100

----------------------------------------------------------------------
 .../head/filter/JavaScriptDeferHeaderResponse.java  | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/634fd247/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java
index 1a5da3f..c00519f 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java
@@ -31,11 +31,17 @@ import org.apache.wicket.request.Response;
 import org.apache.wicket.util.string.Strings;
 
 /**
- * A header response that defers all {@link 
AbstractJavaScriptReferenceHeaderItem}s.
+ * A header response which defers all {@link 
AbstractJavaScriptReferenceHeaderItem}s.
  * <p>
  * To prevent any error because of possible dependencies to referenced 
JavaScript files
  * *all* {@link JavaScriptHeaderItem}s are replaced with suitable 
implementations that
- * delay any execution until {@link AbstractJavaScriptReferenceHeaderItem}s 
have been loaded.
+ * delay any execution until all deferred {@link 
AbstractJavaScriptReferenceHeaderItem}s
+ * have been loaded.
+ * <p>
+ * Note: This solution depends on the execution order of JavaScript in the 
browser:
+ * The 'DOMContentLoaded' event has to be fired <me>after</em> all deferred 
JavaScript
+ * resources have been loaded. This doesn't seem to be the case in all 
browsers, thus
+ * this class should be considered experimental.
  * 
  * @author svenmeier
 + */
@@ -54,7 +60,7 @@ public class JavaScriptDeferHeaderResponse extends 
DecoratingHeaderResponse
        @Override
        public void render(HeaderItem item)
        {
-               if (item instanceof IWrappedHeaderItem) {
+               while (item instanceof IWrappedHeaderItem) {
                        item = ((IWrappedHeaderItem)item).getWrapped();
                }
 
@@ -77,7 +83,7 @@ public class JavaScriptDeferHeaderResponse extends 
DecoratingHeaderResponse
         * For Ajax requests we utilize the fact, that {@link 
PartialPageUpdate} renders {@link #getJavaScript()} only,
         * thus executing the JavaScript directly without any event 
registration.
         */
-       private class NativeOnDomContentLoadedHeaderItem extends 
OnDomReadyHeaderItem
+       private static class NativeOnDomContentLoadedHeaderItem extends 
OnDomReadyHeaderItem
        {
                private static final long serialVersionUID = 1L;
 
@@ -111,7 +117,7 @@ public class JavaScriptDeferHeaderResponse extends 
DecoratingHeaderResponse
         * For Ajax requests we utilize the fact, that {@link 
PartialPageUpdate} renders {@link #getJavaScript()} only,
         * thus executing the JavaScript directly without any event 
registration.
         */
-       private class NativeOnLoadHeaderItem extends OnLoadHeaderItem
+       private static class NativeOnLoadHeaderItem extends OnLoadHeaderItem
        {
                private static final long serialVersionUID = 1L;
 

Reply via email to