[ 
https://issues.apache.org/jira/browse/WICKET-3927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13162804#comment-13162804
 ] 

Johan Compagner commented on WICKET-3927:
-----------------------------------------

i found the problem:
instead of doing this:

                        var img = document.createElement('img');
                        img.onerror = function() {
                                notify();
                        }
                        img.src = css.href;

i do now this:

                        var img = document.createElement('img');
                        img.src = css.href;
                        if (img.complete) {
                          notify();
                        }
                        else {
                          img.onerror = function() {
                            notify();
                          }
                        }


because i think mobile browsers are really somehow single threaded. when a link 
is created with a href it will really load that css already (this is not  done 
in the background somehow)
and because of that at the time we make the img and assign the href everything 
is already loaded and the img is directly in a complete stage

In the desktop browsers it will for me always come in the else, but in the 
mobile browser it always goes to the if part.
i did find here some more info:

http://lucassmith.name/2008/11/is-my-image-loaded.html

We do already large parts what is explained there, except the part of testing 
'complete' 

                
> Use a resource loading lib to setup order for processing ajax response 
> fragments
> --------------------------------------------------------------------------------
>
>                 Key: WICKET-3927
>                 URL: https://issues.apache.org/jira/browse/WICKET-3927
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.17, 1.5-RC5.1
>         Environment: I tested Firefox 4, IE 7, 8, 9 and Chromium 12.0.742.112
>            Reporter: Jannis Bloemendal
>             Fix For: 6.0.0
>
>         Attachments: WICKET-3927-backport-mgrigorov.patch, 
> WICKET-3927-quickstart.tar.gz, WICKET-3927.patch, WICKET-3927_2.patch
>
>
> When css head contributions are added by an ajax response, executed / 
> contributed javascript  can not rely on the css to be rendered. This can for 
> example be a problem for a javascript layout manager which gets triggered 
> with the ajax response. 
> It is more a short-come of current browsers, but can be worked around for 
> example by the method described in the blog post:
> "CSSP: Loading CSS with Javascript - and getting an onload callback."
> http://otaqui.com/blog/890/cssp-loading-css-with-javascript-and-getting-an-onload-callback/

--
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