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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:20:40+00:00 2026-05-16T08:20:40+00:00

When adapting jQuery’s isFunction method isFunction: function( obj ) { return toString.call(obj) === "[object

  • 0

When adapting jQuery’s isFunction method

isFunction: function( obj ) {
  return toString.call(obj) === "[object Function]";
}

InternetExlorer 8 returns the following error: "Object doesn’t support this property or method". A good article digging into this function won’t fix this behaviour. To check wether obj is defined, I changed the function in reference to the MSDN article:

isFunction: function( obj ) {
  return obj && toString.call(obj) === "[object Function]";
}

Any other ideas for a solution?

  • 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-16T08:20:41+00:00Added an answer on May 16, 2026 at 8:20 am

    You need to call the toString method directly from the Object.prototype object:

    function isFunction (obj) {
        return Object.prototype.toString.call(obj) === "[object Function]";
    }
    
    alert(isFunction({})); // false
    alert(isFunction(function{})); // true
    

    jQuery has a local variable named toString that refers to the method on Object.prototype.

    Calling just toString.call(obj); without declaring a toString identifier on scope, works on Firefox, Chrome, etc, just because the Global object inherits from Object.prototype, but this is not guaranteed by the spec.

    Object.prototype.isPrototypeOf(window); // false on IE
    

    The article you link to talks about a change that was introduced in the ECMAScript 5th Edition specification to the call and apply methods.

    Those methods allow you to invoke a function passing the first argument as the this value of the invoked function.

    On ECMAScript 3, if this argument was undefined or null, the this value of the invoked function will refer to the global object, for example:

    function test () {  return this; }
    test.call(null) === window; // true
    

    But that changed in ES5, the value should now be passed without modification and that caused the Object.prototype.toString to throw an exception, because an object argument was expected.

    The specification of that method changed, now if the this value refers to undefined or null the string "[object Undefined]" or "[object Null]" will be returned, fixing the problem (thing that I don’t think is really good, since both results results feel just wrong, undefined and null are not objects, they are primitives… that made me remember typeof null == 'object'… Moreover I think it messes up with the concept of the [[Class]] internal property, anyway…)

    Now you might wonder why jQuery uses this method to check for a function object, instead of using the typeof operator?

    Implementation bugs, for example in Chrome/Safari/WebKit, the typeof for RegExp objects returns "function", because RegExp objects where made callable, e.g.:

    typeof /foo/; // "function" in Chrome/Safari/WebKit
    

    The typeof operator returns "function" if the object implements the [[Call]] internal property, which made objects to be callable.

    This was originally introduced by the Mozilla implementations, invoking a RegExp object is equivalent to call the exec method.

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

Sidebar

Related Questions

I have the following jQuery which I need adapting: $(document).ready(function(){ $(.rss-popup a).hover(function() { $(this).next(em).stop(true,
Currently, I'm adapting a registration page to use Ajax/jQuery. Its in the simple stage,
What's the best practise when adapting C-style functions which return a true/false to Java?
I am adapting the Coverflow technique to work with a div. Following is the
I am adapting the Coverflow technique to work with a div. The coverflow function
I'm following a tutorial for a menu bar and I'm having trouble adapting it
I'm working on adapting a jQuery slider that originally had 10 thumbnails. I only
I've been adapting a tutorial on .obj file loading on the windows system to
I am now adapting my formula for skewness to make a kurtosis function in
I am just starting out with JQuery and Javascript, and adapting a nested set

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.