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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:03:59+00:00 2026-05-30T20:03:59+00:00

I was trying to understand what I could from jQuery’s animation functions, but ended

  • 0

I was trying to understand what I could from jQuery’s animation functions, but ended up running into all sorts of internal functions I didn’t understand, and ultimately landed on isWindow. The code for isWindow checks to see if an object has the property setInterval, and returns false otherwise.

Of course, any object could have the property setInterval without being the window, and although it would almost have to be a deliberate attempt to sabotage jQuery’s functionality to have an object with that exact property name, I can imagine some reasonable cases where it could be unintentional.

Is there not a better way to check if an object is a window object? Couldn’t they use something along the lines of

obj.setInterval && obj.setInterval.toString() == 'function setIternval(){ [native code] }

I know the return of toString of an internal function isn’t going to be standard across all browsers, but the writers of jQuery seem to have a great understanding of these cross-browser differences. I’m also aware that this isn’t a fool-proof method either, as someone could easily override the toString method to return that same string, but this would still prevent the problem of having an object mistaken for a window.

I wouldn’t ask if I thought that isWindow was only used on internal objects by jQuery, but it was part of isPlainObject, which is used in .extend, which can be used on external objects.

  • 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-30T20:04:00+00:00Added an answer on May 30, 2026 at 8:04 pm

    What about:

    function isWindow(obj) {
      var toString = Object.prototype.toString.call(obj);
      return toString == '[object global]' || toString == '[object Window]' || toString == '[object DOMWindow]';
    }
    

    Seems to work in Chrome, Firefox, Opera, IE and Safari (Newest versions)

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

Sidebar

Related Questions

I have been trying to understand how to return links from yql results, but
I am trying to understand the Scala quicksort example from Wikipedia. How could the
I'm having a bit of trouble trying to understand how WARP could potentially interact
Trying to understand the options for will_paginate's paginate method: :page — REQUIRED, but defaults
Trying to understand Ruby a bit better, I ran into this code surfing the
I'am trying to understand the example from program_options of the boost library ( http://www.boost.org/doc/libs/1_38_0/doc/html/program_options/tutorial.html#id3761458
I am trying to understand from the API the purpose of PendingIntent . Sometimes
I was just trying to learn and understand jQuery source code (so far with
I'm trying to do my frist steps with jQuery but I have some trouble
I am trying to understand the decorator pattern and from the examples I understand

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.