Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistype in API documentation: list => _list #16725

Open
KoGor opened this issue Apr 29, 2015 · 1 comment
Open

Mistype in API documentation: list => _list #16725

KoGor opened this issue Apr 29, 2015 · 1 comment

Comments

@KoGor
Copy link

KoGor commented Apr 29, 2015

JS property list doesn't exist. but there is _list with underscore. Please repair it in code or in docs and examples.

@vlazar
Copy link
Collaborator

vlazar commented May 11, 2015

My 5 cents about current API.

The list property is a bit misleading. There is a setter and it allows to initialize the list of items for completer from different sources:

completer.list = [ "one", "two" ];
completer.list = "one,two";
completer.list = "#selector";
completer.list = $("#selector");

The completer._list property on the other hand always returns Array of strings and underscore in its name implies that it is private.

So is the following code intuitive?

// set list of items
completer.list = "#selector"; // with 2 elements: "one", "two"
// > "#selector"

// get list of items
completer._list;
// > [ "one", "two" ]

I'm started to work on #14565 and it's better not to use _list in tests, as it is private. Having the public API to get the current list of items would be great (not only for tests). However maybe it's better to use different name. Something like:

// get list of items
completer.items;
// > [ "one", "two" ]
// and (maybe) set list of items (always from array)
completer.items = [ "another", "list" ];
// > [ "another", "list" ]

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants