Skip to main content

Bug Tracker

Side navigation

#15090 closed bug (migrated)

Opened May 13, 2014 08:18AM UTC

Closed October 21, 2014 12:42AM UTC

$.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.

Attachments (0)
Change History (2)

Changed May 13, 2014 02:13PM UTC by dmethvin comment:1

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/

Changed October 21, 2014 12:42AM UTC by m_gol comment:2

resolution: → migrated
status: openclosed