#7927 closed bug (notabug)
Widget inherits super widget properties
Reported by: | mrubio | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.widget | Version: | 1.8.16 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If you make widget foo, and then widget bar which extends foo, the extended widget(foo) prototype will inherit its properties.
Precondition is the property must be an object, and must be empty on the base widget.
var meh = { foo:{}, _create: function() { } } jQuery.widget('fd.meh',meh); var moh = { foo:{bar:'bar'}, _create: function() { } } jQuery.widget('fd.moh',jQuery.fd.meh,moh); console.log(jQuery.fd.meh.prototype);
Change History (3)
comment:1 follow-up: 2 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 11 years ago by
Replying to scott.gonzalez:
That's just how inheritance works. You're not going to get the expected results even without inheritance if you have an object in your prototype because every instance will be sharing the same object.
I expected them to be copied like options property.
comment:3 Changed 11 years ago by
Well, that actually happens in master (1.9pre), but you're still going to have every instance sharing the same object.
Note: See
TracTickets for help on using
tickets.
That's just how inheritance works. You're not going to get the expected results even without inheritance if you have an object in your prototype because every instance will be sharing the same object.