#15179 closed bug (fixed)
Widget can't be initialized with an option object that has no hasOwnProperty function
Reported by: | Christoph Obexer | Owned by: | Scott González |
---|---|---|---|
Priority: | minor | Milestone: | 1.12.2 |
Component: | ui.widget | Version: | 1.12.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Initializing any widget like:
var options = Object.create(null); options.label = 'Button Label'; $('#button').button(options);
throws an error like:
input[inputIndex].hasOwnProperty is not a function
Runnable example: http://jsbin.com/juneboqere/edit?html,js,output Responsible code: https://github.com/jquery/jquery-ui/blob/ef2e9bab92ae898311baa295590cd487d9071319/ui/widget.js#L186
jQuery UI must not rely on hasOwnProperty of passed objects, but must instead use Object.prototype.hasOwnProperty to avoid this problem.
jQuery's own extend doesn't have this problem and the code below works:
var options = Object.create(null); options.label = 'Button Label'; $('#button').button($.extend({}, options));
Change History (4)
comment:1 Changed 6 years ago by
Component: | ui.core → ui.widget |
---|---|
Status: | new → open |
comment:2 Changed 6 years ago by
comment:3 Changed 6 years ago by
Owner: | set to Scott González |
---|---|
Resolution: | → fixed |
Status: | open → closed |
In b3c0a7f:
comment:4 Changed 6 years ago by
Milestone: | none → 1.12.2 |
---|
Note: See
TracTickets for help on using
tickets.
https://github.com/jquery/jquery-ui/pull/1809