Bug Tracker

Opened 6 years ago

Closed 5 years ago

#15090 closed bug (migrated)

$.isPlainObject returns true for instance of $.Event

Reported by: San4esZ Owned by:
Priority: low Milestone: 2.2
Component: event Version: 2.1.1
Keywords: Cc:
Blocked by: Blocking:

Description

Compare http://jsfiddle.net/San4es/Tkgt3/ and http://jsfiddle.net/San4es/Cst6V/. Seems, that $.isPlainObject($.Event('click')) should return false in both samples.

Use case http://jsfiddle.net/San4es/pA6Cd/ - jQuery 2.x breaks $.Event instance.

Change History (2)

comment:1 Changed 6 years ago by dmethvin

Component: coreevent
Milestone: 2.next2.2
Priority: undecidedlow
Status: newopen

The docs say:

Properties that are an object constructed via new MyCustomObject(args), or built-in JavaScript types such as Date or RegExp, are not re-constructed and will appear as plain Objects in the resulting object or array. -- http://api.jquery.com/jquery.extend/

So expecting anything to maintain its constructedness in a deep-extend is not a good assumption.

However, the event object does seem to pass the .isPlainObject() test which seems wrong.

http://jsfiddle.net/pA6Cd/3/

comment:2 Changed 5 years ago by m_gol

Resolution: migrated
Status: openclosed
Note: See TracTickets for help on using tickets.