Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

head.ready() doesn't fire in FF #62

Closed
rochadk opened this issue Jan 12, 2011 · 19 comments
Closed

head.ready() doesn't fire in FF #62

rochadk opened this issue Jan 12, 2011 · 19 comments

Comments

@rochadk
Copy link

rochadk commented Jan 12, 2011

I'm experiencing an issue where head.ready doesn't fire in FF, it does in chrome and IE.
I've tried debugging, but my js-skills are not good enough yet to figure it out. However, I have discovered by console.logging "handlers" on head, that there is a difference between what it contains. In FF it contains and array with one function which is empty, where as in Chrome the function has an attribute (done = true).

I will gladly provide you with more information if only you tell me what you need.

Here's where I put the console.log:
(function(doc) {
var head = doc.documentElement,
ie = navigator.userAgent.toLowerCase().indexOf("msie") != -1,
ready = false, // is HEAD "ready"
queue = [], // if not -> defer execution
handlers = {}, // user functions waiting for events
scripts = {}, // loadable scripts in different states

     isAsync = doc.createElement("script").async === true ||
                "MozAppearance" in doc.documentElement.style ||
                window.opera;        
console.log(handlers);
    /* rest of the code */

}

In "head" I've put head.js(files); and somewhere in "body" I used head.ready()- which doesn't fire. I tried using the callback function from head.js and that works fine.

@tipiirai
Copy link
Member

few questions:

  • are you using the latest version (0.8) ?
  • what is your Firefox version ?
  • can I see your page live?

Thanks!

@jonasboman
Copy link

Also having the same problem. Using v 0.8 and FF 3.6.13

head.ready fires too quickly. No error is returned, tough.
If I execute a jquery action via the console it works.

If I fire a alert on "onsuccess" with .js("script.js",function(){alert("test")}); then the head.ready works.

Maybe I should trigger a slight pause for FF-users?!

@rochadk
Copy link
Author

rochadk commented Jan 13, 2011

Yes, I'm using the latest version of headjs.
Firefox version is: 3.6.13
Sadly the page I'm working on is not public, but I could try to replicate the error on an public page?

@jonasboman
Copy link

Public test page.
http://demo.allstarsmedia.se/head.html
when ready it should fire an alert box and change color of status text

@tipiirai
Copy link
Member

noticed a really strange thing on the page. if you place both of the head calls inside a same SCRIPT element it works!

investigating this now..

@tipiirai
Copy link
Member

This is now fixed. Here is the commit:

7814fa6

Thanks!

@jonasboman
Copy link

Thank you!

@rochadk
Copy link
Author

rochadk commented Jan 14, 2011

Now it works in FF, but not in Chrome.. am I doing something wrong?

Code:

<script src="/javascript/head.load.min.js" type="text/javascript"></script> <script type="text/javascript"> head.js('/javascript/signup_prompt.js'); </script>
<script type="text/javascript">
head.ready(function(){
console.log('happens');
SignupPrompt.Show(undefined, 'popup');
 });
 </script>

@jonasboman
Copy link

confirming that it does not work in Chrome no longer

@tipiirai
Copy link
Member

ok. thanks! will check this out.

@Porta
Copy link

Porta commented Jan 18, 2011

Similar issue in chromium.
This doesn't work:

        <script type="text/javascript">
        head.ready(function(){
          $(document).ready(function(){
            $('#post_description').defaultvalue('What do you want?');
          });
        });
        </script>

@philk
Copy link

philk commented Feb 2, 2011

Updating to commit cf2e8972122116760f89 fixed this in both Firefox (3.6.13) and Chrome Beta (9.0.597.84) for me. Thanks for fixing it.

@jonasboman
Copy link

load.js doesn't work in FF.

@tipiirai
Copy link
Member

tipiirai commented Feb 4, 2011

@jonasboman can you clarify a bit? ideally with a live demo.

@jonasboman
Copy link

Same url as before.

http://demo.allstarsmedia.se/head.html
head.ready doesnt fire as it should

@Porta
Copy link

Porta commented Feb 4, 2011

I can confirm the test @jonasboman did doesn not work on FF 3.6.13

@tipiirai
Copy link
Member

tipiirai commented Feb 5, 2011

Not having FF 3.6 here but I'm assuming that this particular line

$("p span").html("READY!").addClass("ready");

won't run since the DOM is not ready yet. You have to nest that call inside $(document).ready. I guess alert() will be fired on FF.

@jonasboman
Copy link

It works both in IE and Chrome and on headjs.com it states that you can do this

[code]head.ready(function() {
$("#my").jquery_plugin();
});[/code]

@jonasboman
Copy link

Doing a callback resolved the issue

<script type="text/javascript">head.js("https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js","jquery.rater.js", function(){ $("p span").html("READY!").addClass("ready"); alert("ready to go!"); }); </script>

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants