#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: |
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.
Change History (3)
comment:1 Changed 8 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 8 years ago by
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.
This is not intended to work.