Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6598599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:22:16+00:00 2026-05-25T18:22:16+00:00

When I step through this code, the values pictured result in cssLoaded = 0;

  • 0

screenshot of google chrome developer tools showing that both objects have value

When I step through this code, the values pictured result in cssLoaded = 0; From what I can see, the length is greater than 0 and cssStylesheet.sheet has properties so should be true, therefore cssLoaded should be set to 1, however it’s not happening. I must be missing something here..?

function _cssIsLoaded(cssStylesheet, stylePath) {
var cssLoaded = 0;
if (tryCount == 3){
    console.log('oops');
}
if (cssStylesheet.href == stylePath){
    try {
        if ( cssStylesheet.sheet && cssStylesheet.sheet.cssRules.length > 0 ){
            cssLoaded = 1;}
        else if ( cssStylesheet.styleSheet && cssStylesheet.styleSheet.cssText.length > 0 ){
            cssLoaded = 1;}
        else if ( cssStylesheet.innerHTML && cssStylesheet.innerHTML.length > 0 ){
            cssLoaded = 1;}
        }
        catch(ex){ }
}
    if(cssLoaded) {
        //alert('cssloadedcomplete');
        resetPops();
        $('#video-overlay').show();
        positionElements();
        saveBizzmail();
        console.log('try:' + tryCount)
    } else {
        tryCount+=1;
        console.log('try:' + tryCount);
        setTimeout(function() { this._cssIsLoaded(cssStylesheet); }, 2000);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:22:16+00:00Added an answer on May 25, 2026 at 6:22 pm

    There are three possible ways your code gets cssLoaded == 0;

    1. if (cssStylesheet.href == stylePath) evaluates to false.
    2. All three if/else statements evaluate to false.
    3. One of the if/else statements throws an exception and thus the other if/else statements aren’t executed.

    In troubleshooting your issue, you should verify that the first two are not the issue as those are probably just logic errors in the comparisons or the data coming into the function isn’t what you expected it to be.

    For the third issue, you can implement defensive coding to make sure that all three if/else statements are checked by changing your code to this (you don’t even need the try/catch any more because it allows your code to bypass some of the tests):

    function _cssIsLoaded(cssStylesheet, stylePath) {
        var cssLoaded = 0;
        if (tryCount == 3){
            console.log('oops');
        }
        if (cssStylesheet && cssStylesheet.href == stylePath) {
            if ( cssStylesheet.sheet && cssStylesheet.sheet.cssRules && cssStylesheet.sheet.cssRules.length > 0 ) {
                cssLoaded = 1;
            }
            else if ( cssStylesheet.styleSheet && cssStylesheet.styleSheet.cssText && cssStylesheet.styleSheet.cssText.length > 0 ) {
                cssLoaded = 1;
            }
            else if ( cssStylesheet.innerHTML && cssStylesheet.innerHTML.length > 0 ) {
                cssLoaded = 1;
            }
        }
        if(cssLoaded) {
            //alert('cssloadedcomplete');
            resetPops();
            $('#video-overlay').show();
            positionElements();
            saveBizzmail();
            console.log('try:' + tryCount)
        } else {
            tryCount+=1;
            console.log('try:' + tryCount);
            setTimeout(function() { this._cssIsLoaded(cssStylesheet); }, 2000);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an easier way to step through the code than to start the
back again with some more SQLAlchemy shenanigans. Let me step through this. My table
I seem to have missed something - in this step through it talks through
I would like to step through dataset designer code in an ASP.NET project. How
I would like to step through Ruby code at runtime, but it seems difficult
If I step through the following code the call to ReturnOne() is skipped. static
Is it possible to step through a mysql stored procedure, watching the values of
Ok so I have a dice throw app... When I step through the code
Is there a way to step through a .bat script? The thing is, I
I would like to be able to step through an application deployed to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.