Skip to main content

Search and Top Navigation

#8997 closed feature (wontfix)

Opened January 22, 2013 12:21PM UTC

Closed January 22, 2013 02:01PM UTC

Last modified January 23, 2013 10:00AM UTC

Implementation of private methods

Reported by: sievlev Owned by:
Priority: minor Milestone: none
Component: ui.widget Version: 1.10.0
Keywords: Cc:
Blocked by: Blocking:
Description

In current implementation of widgets it's easy to accidentally overload an internal methods.

For example, I can create an own _createButtons() method in my widget inherited from $.ui.dialog. As a result I will corrupt internal routines in $.ui.dialog widget.

I suggest to implement a real private methods to avoid possible conflicts.

For simplicity reasons I suggest to expand naming conventions. Like in python or glibc all methods started with two underscore symbols will be treated as a private methods.

To call a private method you will have to use a special call similar to _super.

See https://github.com/jquery/jquery-ui/pull/889 for details.

Attachments (0)
Change History (3)

Changed January 22, 2013 02:01PM UTC by scottgonzalez comment:1

component: ui.coreui.widget
resolution: → wontfix
status: newclosed

This isn't going to happen. Everything is exposed and we like it that way.

Changed January 23, 2013 07:26AM UTC by sievlev comment:2

So I can safely override the undocumented methods and use them in any way, isn't it?

As I understand you I can have an own version of _createButtons in my dialog?

Changed January 23, 2013 10:00AM UTC by jzaefferer comment:3

No you can't. Our widgets are generally not designed for inheritance, so if you extend something, you have to know what you're doing. There are a few exceptions like the _renderItem method in autocomplete, which is specifically intended for overriding. There is definitely more work to be done on documentation: https://github.com/jquery/api.jqueryui.com/issues/20