Skip to main content

Search and Top Navigation

#10587 closed bug (notabug)

Opened September 05, 2014 02:05PM UTC

Closed September 05, 2014 02:10PM UTC

Last modified September 10, 2014 01:58PM UTC

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

Updates of jQuery and jQuery UI broke the following widget code:

http://jsfiddle.net/fyox1r56/2/ - works in jQuery 1.9.1 + jQuery 1.9.2

http://jsfiddle.net/fyox1r56/3/ - 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.

Attachments (0)
Change History (3)

Changed September 05, 2014 02:10PM UTC by scottgonzalez comment:1

resolution: → notabug
status: newclosed

This is not intended to work.

Changed September 09, 2014 03:13PM UTC by victor-homyakov comment:2

Nowhere in the documentation for $.widget (http://api.jqueryui.com/jQuery.widget/) was stated that not only widget's prototype, but also each and every of prototype's properties should be plain object (http://api.jquery.com/Types/#PlainObject).

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

Changed September 10, 2014 01:58PM UTC by scottgonzalez comment:3

This is just how prototypes work in JavaScript.