Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#10587 closed bug (notabug)

$.widget() breaks class instances passed in widget prototype

Reported by: Victor Homyakov Owned by:
Priority: minor Milestone: none
Component: ui.widget Version: 1.11.1
Keywords: Cc:
Blocked by: Blocking:


Updates of jQuery and jQuery UI broke the following widget code: - works in jQuery 1.9.1 + jQuery 1.9.2 - throws in jQuery 2.0.2 + jQuery 1.10.3

Now when widget prototype contains an object, it is cloned no matter when it's a plain object or an instance of some class with some code in its prototype chain.

This is because $.widget relies on isPlainObject functionality which was recently substantially changed in jQuery.

Change History (3)

comment:1 Changed 8 years ago by Scott González

Resolution: notabug
Status: newclosed

This is not intended to work.

comment:2 Changed 8 years ago by Victor Homyakov

Nowhere in the documentation for $.widget ( was stated that not only widget's prototype, but also each and every of prototype's properties should be plain object (

Also, nowhere is stated that prototype's properties not satisfying $.isPlainObject() are shallow cloned.

comment:3 Changed 8 years ago by Scott González

This is just how prototypes work in JavaScript.

Note: See TracTickets for help on using tickets.