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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:56:17+00:00 2026-05-25T06:56:17+00:00

Reading through the jQuery documentation about the event object and its constructor $.Event() I

  • 0

Reading through the jQuery documentation about the event object and its constructor $.Event() I see:

The new operator is optional [when calling the constructor].

That’s cool! How did the jQuery people pull such a trick?

  • 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-25T06:56:18+00:00Added an answer on May 25, 2026 at 6:56 am

    John Resig explains this pretty well: http://ejohn.org/apps/learn/#36 and http://ejohn.org/apps/learn/#38

    Basically, Event is a function and an object (functions are objects). The first line of Event checks if it is being called as a function or as an instance of the Event object (with the new operator).

    If you are looking for specifically how jQuery does it, look at line 3134-3138 of the jQuery source:

    jQuery.Event = function( src, props ) {
        // Allow instantiation without the 'new' keyword
        if ( !this.preventDefault ) {
            return new jQuery.Event( src, props );
        }
    

    And explanation for this is on the jQuery forms.

    Basically, on lines 3178-3194 the preventDefault event is added to the Event prototype. If the event is instantiated with new it will be given this preventDefault method. Otherwise, it won’t be defined.

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

Sidebar

Related Questions

Reading through the Flickr API documentation it keeps stating I require an API key
Reading through some of the questions here, the general concensus seems to be that
Reading through the SendAsync , BeginAsync method illustrations of Socket s, I realized that
Reading through documentation, I found following: 1.9.1 1.8.4 1.8.2 A version of 1.8.2 select
I have been reading through the C++ FAQ and was curious about the friend
I'm reading through the Zend Framework coding standards , where they state that curly
Thanks for reading. I'm a bit new to jQuery, and am trying to make
I have a script that uses jQuery to POST data through AJAX to a
I have been reading around and know that by default jQuery within a the
i'm reading through jQuery's Plugins/Authoring though i already wrote a few jQuery-Plugins. Now I

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.