AJAX reloading of stylesheets does not work with HtmlUnit
---------------------------------------------------------

                 Key: WICKET-4362
                 URL: https://issues.apache.org/jira/browse/WICKET-4362
             Project: Wicket
          Issue Type: Bug
            Reporter: Andreas Kappler
            Priority: Minor


There is an issue with dynamically loading stylesheets when using HtmlUnit.

In wicket-ajax.js:1624 the following code is used to detect when the stylesheet 
has loaded:
 // 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');
 var notifyCalled = false;
 img.onerror = function() {
     if (!notifyCalled) {
         notifyCalled = true;
         notify();
     }
 }
 img.src = css.href;
 if (img.complete) {
     if (!notifyCalled) {
         notifyCalled = true;
         notify();
     }
 }

The trick with the img tag does not work in HtmlUnit and notify will never be 
called which results in the AJAX response not being parsed successfully.

This may well be a HtmlUnit problem but I put this on this tracker in case 
somebody has another solution for the problem that could make it in the next 
wicket maintenance release. HtmlUnit is somewhat slower with its release plan.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to