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 8039367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:32:50+00:00 2026-06-05T03:32:50+00:00

Radiant::loadCSS = (fn, scope) -> head = document.getElementsByTagName(head)[0] link = document.createElement(link) link.setAttribute href, /

  • 0
Radiant::loadCSS = (fn, scope) ->
  head = document.getElementsByTagName("head")[0]
  link = document.createElement("link")
  link.setAttribute "href", "/" + ri.context + "/css/" + @obj + ".css"
  link.setAttribute "rel", "stylesheet"
  link.setAttribute "type", "text/css"
  sheet = undefined
  cssRules = undefined
  if "sheet" of link
    sheet = "sheet"
    cssRules = "cssRules"
  else
    sheet = "styleSheet"
    cssRules = "rules"
  timeout_id = setInterval(->
    try
      if link[sheet] and link[sheet][cssRules].length
        clearInterval timeout_id
        clearTimeout timeout_id
        fn.call scope or window, true, link #LINE THAT ERRORS OUT!!!
    #finally
  , 10)
  timeout_id = setTimeout(->
    clearInterval timeout_id
    clearTimeout timeout_id
    head.removeChild link
    fn.call scope or window, false, link
  , 15000)
  head.appendChild link
  link

So above is my translation of a function ripped from here : Dynamically loading css file using javascript with callback without jQuery

When I had this in straight javascript it worked great, but the coffee version is giving me problems in ie8 'fn' is null or not an object

Here is the rendered javascript for that section:

timeout_id = setInterval(function() {
  try {
    if (link[sheet] && link[sheet][cssRules].length) {
      clearInterval(timeout_id);
      clearTimeout(timeout_id);
      return fn.call(scope || window, true, link); //ERROR LINE!!!
    }
  } catch (_error) {}
}, 10);

Anyway I am new to try and catch and just don’t understand what is going wrong here. Thanks in advance everyone!

  • 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-06-05T03:32:51+00:00Added an answer on June 5, 2026 at 3:32 am

    I think this has less to do with try/catch and more to do with that for whatever reason, fn is not defined when the callback executes (as the error says). Are you sure fn is passed into loadCSS in the cases where you get the error?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone have any experience yet getting Radiant CMS extensions to actually make it onto
My end goal is local development of a Radiant CMS installation. So, need rails
Post says it all. I've cloned a gem (particularly radiant) after clone it from
I'm developing a lot of RadiantCMS applications, and this CMS uses custom radiant tags
Is there a hook avaialable to edit the head tag in the Admin section
I'm trying to install Radiant CMS but whenever I run: rake db:bootstrap Inside the
I trying to set up a simple blog with Radiant CMS and have a
Hallo I'm new to Rails and have one simple question. I'm using radiant as
In Radiant CMS when I'm trying to save any page that has any PageType
I have asked this question in Radiant CMS google group, but no one answered

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.