Author: mgrigorov
Date: Wed Oct 26 07:57:30 2011
New Revision: 1189061

URL: http://svn.apache.org/viewvc?rev=1189061&view=rev
Log:
WICKET-3927 Use a resource loading lib to setup order for processing ajax 
response fragments

backport r1177562.


Modified:
    
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js?rev=1189061&r1=1189060&r2=1189061&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
 Wed Oct 26 07:57:30 2011
@@ -1614,10 +1614,17 @@ Wicket.Head.Contributor.prototype = {
                        
                        // add element to head
                        Wicket.Head.addElement(css);
-                       
-                       // continue to next step
-                       notify();
-               });
+
+                       // cross browser way to check when the css is loaded
+                       // taked from 
http://www.backalleycoder.com/2011/03/20/link-tag-css-stylesheet-load-event/
+                       // this makes a second GET request to the css but it 
gets it either from the cache or
+                       // downloads just the first several bytes and realizes 
that the MIME is wrong and ignores the rest
+                       var img = document.createElement('img');
+                       img.onerror = function() {
+                               notify();
+                       }
+                       img.src = css.href;
+        });
        },
        
        // Process an inline style element


Reply via email to