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

  • SEARCH
  • Home
  • 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 7683287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:45:42+00:00 2026-05-31T18:45:42+00:00

Good evening, I have been trying to wrap my head about this, below, code

  • 0

Good evening,

I have been trying to wrap my head about this, below, code written by Chris Coyer.

I understand this is a self-invoked function named ‘supports’, but what I don’t understand is how ‘supports’ is passed an argument (as seen below in the // Test section). Please could someone explain this or point me in the right direction for further reading?

// Generic Testing Function
var supports = (function() {
   var div     = document.createElement('div'),
       vendors = 'Khtml Ms O Moz Webkit'.split(' '),
       len     = vendors.length;  

    return function(prop) {
      if ( prop in div.style ) return true;  

      prop = prop.replace(/^[a-z]/, function(val) {
         return val.toUpperCase();
      });  

      while(len--) {
         if ( vendors[len] + prop in div.style ) {
            return true;
         }
      }
      return false;
   };
})();  

// Test
if ( supports('flowInto') ) {
   $("html").addClass('cssregions');
} else {
   $("html").addClass('no-cssregions');
}
  • 1 1 Answer
  • 1 View
  • 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-31T18:45:43+00:00Added an answer on May 31, 2026 at 6:45 pm

    Let’s see what supports is:

    var supports = (function() {
        /* ... */
    })();
    

    OK, so supports is the return value of an anonymous function that gets invoked on the spot. What does this anonymous function return?

        return function(prop) {
          if ( prop in div.style ) return true;  
    
          prop = prop.replace(/^[a-z]/, function(val) {
             return val.toUpperCase();
          });  
    
          while(len--) {
             if ( vendors[len] + prop in div.style ) {
                return true;
             }
          }
          return false;
       };
    

    Alright, so the return value of this function (which is what support holds as we said above) is actually a function that takes one argument (prop).

    So at this point it should become clear that it’s perfectly logical to do what the test section does, i.e. call that function:

    if ( supports('flowInto') ) /* .... */
    

    It’s really not complicated when you know where to start from.

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

Sidebar

Related Questions

Good evening, I am tired and have been fighting with this for hours. I
Good evening :-)! I have this code to use Drag & Drop method for
Good evening. For a project, I have to create a system. In this system,
Good evening fellow stackers, I have a mutex and threaded related question about //
Good evening, here is what I am trying to achieve, I currently have a
Good evening. I have a problem. i am using has_secure_password and cause of this
Good Evening everyone, I've been trying to figure out the most efficient way to
Good Evening folks. This is my code: static private function removeAccentedLetters($input){ for ($i =
Good evening, In my app that I'm currently developing, I have a class that
Good evening all, I've been working on an MD5 tool in C# that takes

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.