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

Document that replace() gets called with a Suggestion. #16927

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ <h1>Extend</h1>
<tr>
<td><code>replace</code></td>
<td>Controls how the user’s selection replaces the user’s input. For example, this is useful if you want the selection to only partially replace the user’s input.</td>
<td>Function that takes one parameter, the text of the selected option, and is responsible for replacing the current input value with it.
<td>This function takes one parameter, an object with <code>label</code> and <code>value</code> attributes (see <a href="#js-prop-data"><code>data</code></a> for more details), and is responsible for setting the current input value.
</td>
<td><pre class="language-javascript"><code>function (text) {
this.input.value = text;
<td><pre class="language-javascript"><code>function (suggestion) {
this.input.value = suggestion.value;
}</code></pre></td>
</tr>
<tr>
<tr id="js-prop-data">
<td><code>data</code></td>
<td>Controls suggestions' <code>label</code> and <code>value</code>. This is useful if you have list items in custom format, or want to change list items based on user's input.</td>
<td>Function that takes two parameters, the first one being the original list item and the second a string with the user’s input and returns a list item in one of supported by default formats:
Expand Down